XF 1.2 enabling seo with nginx gives 404 errors

Nicky Vermeersch

Active member
I recently decided to undergo an adventure, and try to setup a VPS completely from scratch. I installed php-fpm with nginx. I read some articles here on the forum, as well as the xenforo help. However each time when I enable the SEO Friendly Links, I get 404 errors when I for example click on the Members page, and I have no idea how to fix them :(

This is my first time using nginx and doing the entire setup myself, so please forgive me for any dumb mistakes :p

this is my /etc/nginx/conf.d/default.conf file
Code:
server {
    listen 80;
    server_name localhost;

    location / {
        root  /usr/share/nginx/html;
        index  index.php index.html index.htm;
    }
    error_page  500 502 503 504  /50x.html;
    location = /50x.html {
        root  /usr/share/nginx/html;
    }
    location ~ \.php$ {
        root          /usr/share/nginx/html;
        try_files $uri =404;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
    location / {
        try_files $uri $uri/ /index.php?$uri&$args;
        index index.php index.html;
    }
    location /data/ {
        allow 127.0.0.1;
        deny all;
    location /internal_data/ {
        allow 127.0.0.1;
        deny all;
    }
    location /library/ {
        allow 127.0.0.1;
        deny all;
    }
}

/etc/nginx/nginx.conf

Code:
user  nginx;
worker_processes  4;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}
http {
    include      /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    keepalive_timeout  65;
    include /etc/nginx/conf.d/*.conf;
}
 
Found the error, they were pretty retarded. I basically didn't pick them up because i did service nginx reload instead of restart, and because of that it never gave me errors. I found out that I had duplicate rules which don't work together, and that I forgot a curly brace :o

Red means deleting
Green means adding

server {
listen 80;
server_name localhost;

location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.php?$uri&$args;
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
root /usr/share/nginx/html;
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location / {
try_files $uri $uri/ /index.php?$uri&$args;
index index.php index.html;

}
location /data/ {
allow 127.0.0.1;
deny all;
}
location /internal_data/ {
allow 127.0.0.1;
deny all;
}
location /library/ {
allow 127.0.0.1;
deny all;
}
}
 
Top Bottom