XF 1.2 nginx friendly url rewrite

optrex

Well-known member
I'm new to nginx and I'm struggling with the friendly url rewrite.
I've added the relevant xenforo rewrite riles in between the ####### markers, but I still get a 404

Can anyone help please?

Code:
 root  /var/www/forum/htdocs;
        index  index.html index.htm index.php;
    }

    error_page  404              /404.html;
    location = /404.html {
        root  /usr/share/nginx/html;
    }

############
location /var/www/forum/htdocs/ {
        try_files $uri $uri/ /xf/index.php?$uri&$args;
        index index.php index.html;
}
location /var/www/forum/htdocs/internal_data/ {
        internal;
}
location /var/www/forum/htdocs/library/ {
      internal;
}
 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;
 }
#############
    # redirect server error pages to the static page /50x.html
    #
    error_page  500 502 503 504  /50x.html;
    location = /50x.html {
        root  /usr/share/nginx/html;
    }
    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass  http://127.0.0.1;
    #}
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        root          /var/www/forum/htdocs;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index  index.php;
        try_files $uri =403;
        fastcgi_param  SCRIPT_FILENAME $request_filename;
        include        fastcgi_params;
}
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}
 
Rich (BB code):
root  /var/www/forum/htdocs;
        index  index.html index.htm index.php;
    }

    error_page  404              /404.html;
    location = /404.html {
        root  /usr/share/nginx/html;
    }

############
location /var/www/forum/htdocs/ {
        try_files $uri $uri/ /xf/index.php?$uri&$args;
        index index.php index.html;
}
location /var/www/forum/htdocs/internal_data/ {
        internal;
}
location /var/www/forum/htdocs/library/ {
      internal;
}
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;
}
#############
    # redirect server error pages to the static page /50x.html
    #
    error_page  500 502 503 504  /50x.html;
    location = /50x.html {
        root  /usr/share/nginx/html;
    }
    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass  http://127.0.0.1;
    #}
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        root          /var/www/forum/htdocs;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index  index.php;
        try_files $uri =403;
        fastcgi_param  SCRIPT_FILENAME $request_filename;
        include        fastcgi_params;
}
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

You missed a spot that I've highlighted in red above.
 
Back
Top Bottom