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

XF 1.4 Friendly URLs with nginx

dutchbb

Well-known member
#1
I followed instructions from the xf manual but must have done something wrong since it isn't working, here's what I have in my domain.nl.conf file:

Code:
  GNU nano 2.2.6                 File: domain.nl.conf                               Modified

server {
        listen xxxx;
        server_name domain.nl www.domain.nl;
        root /var/www/domain.nl/public_html;

        access_log /var/www/domain.nl/logs/http_access;
        error_log /var/www/domain.nl/logs/http_error;

        index index.html index.php;

        location  /. {
                return 404;
        }

        if (!-e $request_filename) {
                rewrite ^/(.*)$ /index.php last;
        }
        location /test_import_forum {
                auth_basic "Administrator Login";
                auth_basic_user_file /var/www/xxxx
        }

        location ~ /\. { deny  all; }
        location ~ .php$ {
                expires        off;
                include        fastcgi_params;
                fastcgi_pass    unix:/var/run/php5-fpm.sock;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        }

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

location /test_import_forum/internal_data {
        internal;
}
location /test_import_forum/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;
}

}
 
Last edited:

Mike

XenForo developer
Staff member
#2
try_files $uri $uri/ /xf/index.php?$uri&$args;
You didn't change the /xf/ part on that line.

You do also have 2 .php location blocks there. (You do want the try_files line from the XF version at least as this is for security.)
 

dutchbb

Well-known member
#3
Something must still be wrong as I keep getting "File not found."

Code:
server {
        listen xxxx;
        server_name domain.nl www.domain.nl;
        root /var/www/domain.nl/public_html;

        access_log /var/www/domain.nl/logs/http_access;
        error_log /var/www/domain.nl/logs/http_error;

        index index.html index.php;

        location  /. {
                return 404;
        }

        if (!-e $request_filename) {
                rewrite ^/(.*)$ /index.php last;
        }
        location /test_import_forum {
                auth_basic "Administrator Login";
                auth_basic_user_file /var/www/xxxx
        }

        location ~ /\. { deny  all; }
        location ~ .php$ {
                expires        off;
                include        fastcgi_params;
                fastcgi_pass    unix:/var/run/php5-fpm.sock;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        }

location /test_import_forum {
        try_files $uri $uri/ /test_import_forum/index.php?$uri&$args;
        index index.php index.html;
}

location /test_import_forum/internal_data {
        internal;
}
location /test_import_forum/library {
       internal;
}

location ~ \.php$ {
        try_files $uri =404;
}

}
 
Last edited:

Mike

XenForo developer
Staff member
#4
Actually, I just noticed that you have 2 /test_import_forum blocks. Only 1 location block gets matched at a time, so you want to fold them together.