Learn about Centmin Mod LEMP Stack today
Register Now

IP.Board Nginx conf rewite not working

Discussion in 'Forum software usage' started by viralpoet, Dec 13, 2018.

  1. viralpoet

    viralpoet Member

    43
    3
    8
    Mar 5, 2017
    Ratings:
    +9
    Local Time:
    6:05 PM
    1.10.3
    10
    I've been trying to get a bug fixed in the url rewrite but currently nginx fails when restarted.

    Anyone see anything obvious I'm missing?


    Code:
    server {
                server_name astro.nz www.astro.nz;
                return 301 http://www.astro.nz$request_uri;
            }
    
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/astro.nz/log/access.log combined buffer=32k;
      error_log /home/nginx/domains/astro.nz/log/error.log;
    
      root /home/nginx/domains/astro.nz/public;
    
    
    #    location / {
    
            # block common exploits, sql injections etc
            # include /usr/local/nginx/conf/block.conf;
    
            # Enables directory listings when index file not found
            # autoindex  on;
    
            # Shows file listing times as local time
            # autoindex_localtime on;
    
    #        try_files    $uri $uri/ /index.php;
    #    }
    
        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;
    }
    
     
  2. eva2000

    eva2000 Administrator Staff Member

    55,417
    12,256
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,837
    Local Time:
    4:05 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    run nginx config check / test command to see why it fails
    Code (Text):
    nginx -t
    
     
  3. viralpoet

    viralpoet Member

    43
    3
    8
    Mar 5, 2017
    Ratings:
    +9
    Local Time:
    6:05 PM
    1.10.3
    10
    "location" directive is not allowed here in /usr/local/nginx/conf/conf.d/astro.nz.conf:14
     
  4. viralpoet

    viralpoet Member

    43
    3
    8
    Mar 5, 2017
    Ratings:
    +9
    Local Time:
    6:05 PM
    1.10.3
    10
    cool, that helped, so it needed to be within the server call.
     
  5. viralpoet

    viralpoet Member

    43
    3
    8
    Mar 5, 2017
    Ratings:
    +9
    Local Time:
    6:05 PM
    1.10.3
    10
    So while its now working as far as nginx is concerned. I cannot get the friendly urls to rewrite.
    The url portion displays as expected /blog /calendar etc but the page is 404 not found.
    Any suggestions please?
     
  6. eva2000

    eva2000 Administrator Staff Member

    55,417
    12,256
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,837
    Local Time:
    4:05 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  7. Revenge

    Revenge Active Member

    469
    93
    28
    Feb 21, 2016
    Portugal
    Ratings:
    +354
    Local Time:
    7:05 AM
    1.9.x
    10.1.x
    Its just this:
    try_files $uri $uri/ /index.php;
     
  8. viralpoet

    viralpoet Member

    43
    3
    8
    Mar 5, 2017
    Ratings:
    +9
    Local Time:
    6:05 PM
    1.10.3
    10
    thank you