Want more timely Centmin Mod News Updates?
Become a Member

Joomla Standart Nginx 404 page on url's with *.htm

Discussion in 'Blogs & CMS usage' started by olivergreen, Jul 28, 2017.

Tags:
  1. olivergreen

    olivergreen New Member

    2
    1
    3
    Jul 28, 2017
    Ratings:
    +1
    Local Time:
    9:52 AM
    1.13
    10
    Hello!
    Sorry for my "google translate" english))
    I have a problem. I have a website on Joomla CMS. Previously, it worked by the http protocol and correctly processed non-existent pages such as http://some-site/fake-path/ and http://some-site/fake-path.html

    After installing the SSL certificate on the server, the CMS stopped processing pages like http://some-site/fake-path.html and instead of page 404 of Joomla, the page 404 of Nginx was displayed. Pages of the type http://some-site/fake-path/ are processed by the content management system are still correct.

    On server sites without a certificate, there is no such problem. Advise me how to solve this problem, please.
    [​IMG]
    [​IMG]
     
    Last edited: Jul 28, 2017
  2. dooma

    dooma Member

    226
    22
    18
    Oct 15, 2016
    Cairo
    Ratings:
    +27
    Local Time:
    8:52 AM
    I think you must disable your domain conf. file by renaming it and only allow the ssl conf. file:
    this one should be disabled : /usr/local/nginx/conf/conf.d/newdomain.com.conf
    Code (Text):
    mv /usr/local/nginx/conf/conf.d/newdomain.com.conf /usr/local/nginx/conf/conf.d/newdomain.com.conf-disabled


    Then use the vi or nano and edit the paths of your keys in this file:
    /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf

    finally, restart
    Code (Text):
    nprestart


    **You may want to add right nginx rewrite/location rules at your conf. file.

    I don't know if my solution will work with you or not. we can wait to see what will @eva2000 say. :)

    Thanks
     
  3. eva2000

    eva2000 Administrator Staff Member

    30,162
    6,786
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,137
    Local Time:
    4:52 PM
    Nginx 1.13.x
    MariaDB 5.5
    When you create a new nginx vhost domain via centmin.sh menu option 2 or menu option 22 or via /usr/bin/nv cli command line, you will create the Nginx vhost files and directories. You will get an outputted the path location where it will create the domain name's vhost conf file named newdomain.com.conf (and newdomain.com.ssl.conf if you selected yes to self signed SSL)
    • Nginx vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.conf
    • Nginx HTTP/2 SSL vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf
    • Nginx Self-Signed SSL Certificate Directory at /usr/local/nginx/conf/ssl/newdomain.com
    • Vhost public web root will be at /home/nginx/domains/newdomain.com/public
    • Vhost log directory will be at /home/nginx/domains/newdomain.com/log
    Please post the contents of /usr/local/nginx/conf/conf.d/newdomain.com.conf and if applicable /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf wrapped in CODE tags (outlined at How to use forum BBCODE code tags)

    what is output of these commands in ssh
    Code (Text):
    curl -I https://domain.com
    

    Code (Text):
    curl -I https://www.domain.com
    

    Code (Text):
    curl -I http://domain.com
    

    Code (Text):
    curl -I http://www.domain.com
    

    wrap output in CODE tags

    Are using in your domain's vhost config file Nginx rewrite rules which have urls/links with .html or .html extensions ?

    Centmin Mod default static files include file at /usr/local/nginx/conf/staticfiles.conf handles .html files via Nginx. But by using wordpress with .html extensions you tell Nginx not to serve .html files and serve via PHP-FPM (not ideal as it reduces performance if you use permalinks with .html extensions and thus use PHP-FPM to server .html files)

    If you must use .html extension permalinks, you need to comment out the .html location context from /usr/local/nginx/conf/staticfiles.conf and restart Nginx server as illustrated below with hash # in front
    Code:
        location ~* \.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$ {
            gzip_static off;
            #add_header Pragma public;
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
            }
    
        location ~* \.(js)$ {
            #add_header Pragma public;
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
            }
    
        location ~* \.(css)$ {
            #add_header Pragma public;
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
            }
    
        #location ~* \.(html|htm|txt)$ {
            #add_header Pragma public;
            #add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            #access_log off;
            #expires 1d;
           # break;
           # }
    
        location ~* \.(eot|svg|ttf|woff)$ {
            #add_header Pragma public;
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
            }
    
    You can also use SSH command shortcut below to launch nano linux text editor and edit file /usr/local/nginx/conf/staticfiles.conf
    Code:
    statfilesinc
    latest centmin mod 123.09beta01 should have commented out and disabled the .html location match now, but 123.08stable and older 123.09beta01's might still have it enabled.