Jump to content

Nginx friendly url rewrites


optrexnz

Recommended Posts

Posted

I'm having an issue with friendly URL rewrites in nginx. The page url changes correctly to /blogs or /calendar for instance, but the page displays with a 404 not found message and its driving me nuts as to why.

Here is my conf with the rewrites

 


server {
#            listen 80;
            server_name domain.nz www.domain.nz;
#            return 301 http://www.domain.nz$request_uri;
#        }

  
#  access_log /home/nginx/domains/domain.nz/log/access.log combined buffer=32k;
#  error_log /home/nginx/domains/domain.nz/log/error.log;
 
 root /home/nginx/domains/domain.nz/public;

#location / {
#  try_files $uri $uri/ /index.php?$args;
#}  
 
   location ~^(/page/).*(\.php)$ {
        try_files $uri $uri/ /index.php;
    }
   
 # IP.Board PHP/CGI Protection Allow Access to Interface Files Add Your Specific Application to the List if you Add New Applications

    location ~^/applications/(blog|calendar|chat|cms|core|downloads|forums|gallery|nexus|pastebin|companydirectory|rules|videos|notes|iawards|links|pmviewer|readthattopic|rules)/interface/.*\.(?:php\d*|phtml)$ {
        allow all;
        include /usr/local/nginx/conf/php.conf;
    }

    # Block Access to PHP / PHTML Files
    location ~^/(uploads|datastore|system|plugins)/.*\.(?:php\d*|phtml)$ {
        allow 127.0.0.1;
        deny all;
    }

    # Block Access to Application PHP / PHTML Files Add Your Specific Application to the List if you Add New Applications
    location ~^/applications/(blog|calendar|chat|cms|core|downloads|forums|gallery|nexus|pastebin|companydirectory|rules|videos|notes|iawards|links|pmviewer|readthattopic|rules)/.*\.(?:php\d*|phtml)$ {
        allow 127.0.0.1;
        deny all;
    }
    # Centmin Mod include files Note: If you uncomment the error pages include you won't see the IPB errors via the site.
    include /usr/local/nginx/conf/staticfiles.conf;
    include /usr/local/nginx/conf/php.conf;
    include /usr/local/nginx/conf/drop.conf;
    # include /usr/local/nginx/conf/errorpage.conf;
    include /usr/local/nginx/conf/vts_server.conf;
}

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...