• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 Nginx Friendly URLs

#1
Hello,

I recently took the chance to move my current site from Apache over to Nginx. So far the installation has gone smoothly and everything is working but one thing: Friendly URLs. I understand that on Apache you'd use a .htaccess file to complete this, but on Nginx it is different. I feel as something is configured wrong, or I have placed this content in the wrong file. At /etc/nginx/sites-available/default I have the following config. Any ideas as to why it doesn't work?

Thanks,
Sam.
 

Mike

XenForo developer
Staff member
#4
I don't actually see any part of the recommended config in the config that you provided. You have a try_files line, but it's different from what's needed (it doesn't try index.php).
 
#5
try this in /etc/nginx/conf.d/yourdomain.conf

Code:
location /xf/ {
    try_files $uri $uri/ /xf/index.php?$uri&$args;
    index index.php index.html;
}

location /xf/install/data/ {
    internal;
}
location /xf/install/templates/ {
    internal;
}
location /xf/internal_data/ {
    internal;
}
location /xf/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;
}