Hi,
I am currently trying to switch from Apache to nginx.
As I do not have experience with nginx I thought it would be good idea to start with my dev sub domain.
First, I enabled nginx as described in https://support.plesk.com/hc/en-us/articles/213944825-How-to-enable-Nginx-reverse-proxy-in-Plesk. Verything went well, nginx conf files were created automatically.
Second, I deactivated the proxy mode for this sub-domain. nginx conf files were updated automatically.
Now I am struggling a bit with the SEO-frienldy URLs that worked well on Apache.
I am running a XenForo board. As described here I added the given code in the "Additional nginx directives" section of the sub-domain settings.
Now the home page is ok, but all other links do not work, answering with a 404 for a missing "index.html".
So, nginx doesn't translate the request, but always searches for an index.hml.
E.g. a request for a post https://dev.domain.com/posts/9876 is not answered with https://dev.domain.com/threads/title-of-the-thread.123/page-3#post-9876 but with a missing https://dev.domain.com/posts/9876/index.html.
That's the nginx.conf created by plesk:
And that's what I added in the "Additional nginx directives" section:
The issue seem to be caused by
in the sub-domain's nginx.conf. As soon as I remove this part everything works.
Unfortunately this is only a temporary solution. As stated in the file's header, it will come back
Any ideas how to fix this ?
I am currently trying to switch from Apache to nginx.
As I do not have experience with nginx I thought it would be good idea to start with my dev sub domain.
First, I enabled nginx as described in https://support.plesk.com/hc/en-us/articles/213944825-How-to-enable-Nginx-reverse-proxy-in-Plesk. Verything went well, nginx conf files were created automatically.
Second, I deactivated the proxy mode for this sub-domain. nginx conf files were updated automatically.
Now I am struggling a bit with the SEO-frienldy URLs that worked well on Apache.
I am running a XenForo board. As described here I added the given code in the "Additional nginx directives" section of the sub-domain settings.
Now the home page is ok, but all other links do not work, answering with a 404 for a missing "index.html".
So, nginx doesn't translate the request, but always searches for an index.hml.
E.g. a request for a post https://dev.domain.com/posts/9876 is not answered with https://dev.domain.com/threads/title-of-the-thread.123/page-3#post-9876 but with a missing https://dev.domain.com/posts/9876/index.html.
That's the nginx.conf created by plesk:
Code:
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.
server {
listen 1.2.3.4:443 ssl;
server_name dev.domain.com;
server_name www.dev.domain.com;
server_name ipv4.dev.domain.com;
ssl_certificate /opt/psa/var/certificates/certjdLQBMx;
ssl_certificate_key /opt/psa/var/certificates/certjdLQBMx;
client_max_body_size 128m;
root "/var/www/vhosts/domain.com/httpdocs/dev";
access_log "/var/www/vhosts/system/dev.domain.com/logs/proxy_access_ssl_log";
error_log "/var/www/vhosts/system/dev.domain.com/logs/proxy_error_log";
location ~ ^/plesk-stat/ {
auth_basic "Domain statistics";
auth_basic_user_file "/var/www/vhosts/system/dev.domain.com/pd/d..httpdocs@plesk-stat";
location ~ \.php(/.*)?$ {
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass "unix:///var/www/vhosts/system/dev.domain.com/php-fpm.sock";
include /etc/nginx/fastcgi.conf;
}
location ~ /$ {
index index.html index.cgi index.pl index.php index.xhtml index.htm index.shtml;
}
}
location ~ ^/~(.+?)(/.*?\.php)(/.*)?$ {
alias /var/www/vhosts/domain.com/web_users/$1/$2;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass "unix:///var/www/vhosts/system/dev.domain.com/php-fpm.sock";
include /etc/nginx/fastcgi.conf;
}
location ~ \.php(/.*)?$ {
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass "unix:///var/www/vhosts/system/dev.domain.com/php-fpm.sock";
include /etc/nginx/fastcgi.conf;
}
location ~ /$ {
index index.html index.cgi index.pl index.php index.xhtml index.htm index.shtml;
}
include "/var/www/vhosts/system/dev.domain.com/conf/vhost_nginx.conf";
}
Code:
location / {
try_files $uri $uri/ /index.php?$uri&$args;
index index.php index.html;
}
location /install/data/ {
internal;
}
location /install/templates/ {
internal;
}
location /(internal_data|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;
}
The issue seem to be caused by
Code:
location ~ /$ {
index index.html index.cgi index.pl index.php index.xhtml index.htm index.shtml;
}
Unfortunately this is only a temporary solution. As stated in the file's header, it will come back
Any ideas how to fix this ?