Learn about Centmin Mod LEMP Stack today
Become a Member

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:
    10:29 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

    37,710
    8,254
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,710
    Local Time:
    7:29 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    run nginx config check / test command to see why it fails
    Code (Text):
    nginx -t
    
     
    • Like Like x 1
  3. viralpoet

    viralpoet Member

    43
    3
    8
    Mar 5, 2017
    Ratings:
    +9
    Local Time:
    10:29 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:
    10:29 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:
    10:29 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

    37,710
    8,254
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,710
    Local Time:
    7:29 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    • Like Like x 1
  7. Revenge

    Revenge Active Member

    433
    91
    28
    Feb 21, 2016
    Portugal
    Ratings:
    +324
    Local Time:
    9:29 AM
    1.9.x
    10.1.x
    Its just this:
    try_files $uri $uri/ /index.php;
     
    • Like Like x 4
  8. viralpoet

    viralpoet Member

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