Join the community today
Become a Member

Xenforo 404 not found

Discussion in 'Forum software usage' started by elargento, Jun 1, 2017.

  1. elargento

    elargento Member

    293
    16
    18
    Jan 4, 2016
    Ratings:
    +39
    Local Time:
    3:28 AM
    10
    Friendly URLs aren't working:

    Code:
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    #server {
    #            listen   80;
    #            server_name domain.com;
    #            return 301 $scheme://www.domain.com$request_uri;
    #       }
    
    server {
     
      server_name domain.com www.domain.com;
    
    # 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;
    
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/domain.com/log/access.log combined buffer=256k flush=60m;
      error_log /home/nginx/domains/domain.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/domain.com/autoprotect-domain.com.conf;
      root /home/nginx/domains/domain.com/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      #include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
      # prevent access to ./directories and files
      #location ~ (?:^|/)\. {
      # deny all;
      #}
    
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
    
    # 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;
    
      # Enable for vBulletin usage WITHOUT vbSEO installed
      # More example Nginx vhost configurations at
      # http://centminmod.com/nginx_configure.html
      #try_files    $uri $uri/ /index.php;
    
      }
     
     
        location /forum/ {
                index index.php index.html index.htm;
                try_files $uri $uri/ /index.php?$uri&$args;
             
            }
          location /forum/internal/ {
            internal;
            allow 127.0.0.1;
            deny all;
            }
           
       location /forum/internal_data/ {
            internal;
            allow 127.0.0.1;
            deny all;
            }
    
            location /forum/library/ {
            internal;
            allow 127.0.0.1;
            deny all;
            }
           
              location /forum/install/templates/ {
            internal;
            allow 127.0.0.1;
            deny all;
            }
           
        location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
        }
    
      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;
    }
    
    I already followed Nginx Rewrites for Xenforo Friendly Urls - CentminMod.com LEMP Nginx web stack for CentOS steps.

    What should I set in allow YOURIPADDRESS; ?? The server IP?
     
    Last edited: Jun 1, 2017
  2. eva2000

    eva2000 Administrator Staff Member

    30,949
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,415
    Local Time:
    4:28 PM
    Nginx 1.13.x
    MariaDB 5.5
  3. elargento

    elargento Member

    293
    16
    18
    Jan 4, 2016
    Ratings:
    +39
    Local Time:
    3:28 AM
    10
    Code:
    touch /home/nginx/domains/newdomain.com/public/library/.autoprotect-bypass
    touch /home/nginx/domains/newdomain.com/public/internal_data/.autoprotect-bypass
    touch /home/nginx/domains/newdomain.com/public/install/data/.autoprotect-bypass
    touch /home/nginx/domains/newdomain.com/public/install/templates/.autoprotect-bypass
    Yes
     
  4. eva2000

    eva2000 Administrator Staff Member

    30,949
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,415
    Local Time:
    4:28 PM
    Nginx 1.13.x
    MariaDB 5.5
    then did you restart nginx and php-fpm ?
     
  5. eva2000

    eva2000 Administrator Staff Member

    30,949
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,415
    Local Time:
    4:28 PM
    Nginx 1.13.x
    MariaDB 5.5
    • Like Like x 1
  6. elargento

    elargento Member

    293
    16
    18
    Jan 4, 2016
    Ratings:
    +39
    Local Time:
    3:28 AM
    10
    Still the same, 404 errors when I want to load friendly urls but I'm able to load the forum index.
    There is another issue, the forum keeps me login and login, is that something that could help to determine why there are 404 errors?

    what I did:
    moved forum files and database (forum is installed in forum folder)
    chown nginx.nginx the domains folder

    Code:
    touch /home/nginx/domains/domain.com/public/.autoprotect-bypass
    touch /home/nginx/domains/domain.com/public/forum/.autoprotect-bypass
    touch /home/nginx/domains/domain.com/public/forum/library/.autoprotect-bypass
    touch /home/nginx/domains/domain.com/public/forum/internal_data/.autoprotect-bypass
    touch /home/nginx/domains/domain.com/public/forum/install/data/.autoprotect-bypass
    touch /home/nginx/domains/domain.com/public/forum/install/templates/.autoprotect-bypass
    Code:
    find /home/nginx/domains/domain.com/public/ -type f -print0 | xargs -0 chmod 0640
    find /home/nginx/domains/domain.com/public/ -type d -print0 | xargs -0 chmod 0750
    find /home/nginx/domains/domain.com/public/forum/ -type f -print0 | xargs -0 chmod 0640
    find /home/nginx/domains/domain.com/public/forum/ -type d -print0 | xargs -0 chmod 0750
    find /home/nginx/domains/domain.com/public/forum/internal_data/ -type f -print0 | xargs -0 chmod 0660
    find /home/nginx/domains/domain.com/public/forum/data/ -type f -print0 | xargs -0 chmod 0660
    find /home/nginx/domains/domain.com/public/forum/internal_data/ -type d -print0 | xargs -0 chmod 0770
    find /home/nginx/domains/domain.com/public/forum/data/ -type d -print0 | xargs -0 chmod 0770
    chmod 0755 /home/nginx/domains/domain.com/public
    chmod 0755 /home/nginx/domains/domain.com/public/forum
    run autoprotect.sh
    ngxrestart
    fpmrestart

    .conf file:
    Code:
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    #server {
    #            listen   80;
    #            server_name domain.com;
    #            return 301 $scheme://www.domain.com$request_uri;
    #       }
    
    server {
     
      server_name domain.com www.domain.com;
    
    # 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;
    
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always; 
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/domain.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/domain.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/domain.com/autoprotect-domain.com.conf;
      root /home/nginx/domains/domain.com/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      #include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
      # prevent access to ./directories and files
      #location ~ (?:^|/)\. {
      # deny all;
      #}
    
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
    
    # 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;
    
      # Enable for vBulletin usage WITHOUT vbSEO installed
      # More example Nginx vhost configurations at
      # http://centminmod.com/nginx_configure.html
      #try_files    $uri $uri/ /index.php;
    
      }
     
      location /forum/ {
                index index.php index.html index.htm;
                try_files $uri $uri/ /forums/index.php?$uri&$args;
    
            }
    
            location /forum/internal_data/ {
            internal;
            allow 127.0.0.1;
            deny all;
            }
    
            location /forum/library/ {
            internal;
            allow 127.0.0.1;
            deny all;
            }
    
      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;
    }
    
    Am I missing anything? I don't know where to keep looking
     
  7. eva2000

    eva2000 Administrator Staff Member

    30,949
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,415
    Local Time:
    4:28 PM
    Nginx 1.13.x
    MariaDB 5.5
    you have extra s on end of forums instead of forum
     
    • Like Like x 1