pecadm
Active member
Is there anyone using the combo Plesk and nginx ?
I need some help
I recently switched from Apache to nginx.
To be honest: I do not have any experience with nginx. All my site were on Apache. But now I wanted to know if nginx is that fast as everyone says
Ok, my VPS is running Ubuntu 12 LTS, Plesk Onyx (17 Update #18) for the admin things.
Plesk offers an easy way to enable nginx: https://support.plesk.com/hc/en-us/articles/213944825-How-to-enable-Nginx-reverse-proxy-in-Plesk
I followed all the steps, than deactivated proxy mode. Now nginx is completely serving all the content.
Plesk automatically creates the nginx.conf files. All additional directives have to be put into a form in Plesk, that creates a vhost_nginx.conf, that is included in the Plesk created domain specific nginx.conf .
The automatically created domain specific nginx.conf:
And that's what I added in the "Additional nginx directives" section (based on https://xenforo.com/help/friendly-urls/) and is now in the /var/www/vhosts/system/domain.com/conf/vhost_nginx.conf:
That worked as long as didn't active SEO-friendly URL's in XenForo.
If I activated SEO-friendly URL's, the forum main page is ok, but the server responded with a 404 for an index.html for every thread or post link.
E.g. a request for a post https://www.domain.com/posts/9876 is not answered with https://www.domain.com/threads/title-of-the-thread.123/page-3#post-9876 but with a missing https://www.domain.com/posts/9876/index.html.
Based on suggestion from Plesk support I removed the 2nd part ("location ~ \.php$ ...") and changed the first part. Now the vhost_nginx.conf looks likes this:
Now the SEO-friendly URL's are working.
But I do have some side-effects: my munin reporting (formerly available under https://www.domain.com/munin) is not available anymore, returns only a 404. The same for the plesk stats (https://www.domain.com/plesk-stat).
But the worst thing is: I have lots of errors in the log file like this:
So, again, everyone running the same combo and would like to share the configs ?
Any help on this is highly appreciated.
I am going crazy ^^
I need some help
I recently switched from Apache to nginx.
To be honest: I do not have any experience with nginx. All my site were on Apache. But now I wanted to know if nginx is that fast as everyone says
Ok, my VPS is running Ubuntu 12 LTS, Plesk Onyx (17 Update #18) for the admin things.
Plesk offers an easy way to enable nginx: https://support.plesk.com/hc/en-us/articles/213944825-How-to-enable-Nginx-reverse-proxy-in-Plesk
I followed all the steps, than deactivated proxy mode. Now nginx is completely serving all the content.
Plesk automatically creates the nginx.conf files. All additional directives have to be put into a form in Plesk, that creates a vhost_nginx.conf, that is included in the Plesk created domain specific nginx.conf .
The automatically created domain specific nginx.conf:
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 domain.com;
server_name www.domain.com;
server_name ipv4.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/folder";
access_log "/var/www/vhosts/system/domain.com/logs/proxy_access_ssl_log";
error_log "/var/www/vhosts/system/domain.com/logs/proxy_error_log";
location ~ ^/plesk-stat/ {
auth_basic "Domain statistics";
auth_basic_user_file "/var/www/vhosts/system/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/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/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/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/domain.com/conf/vhost_nginx.conf";
}
And that's what I added in the "Additional nginx directives" section (based on https://xenforo.com/help/friendly-urls/) and is now in the /var/www/vhosts/system/domain.com/conf/vhost_nginx.conf:
Code:
location / {
try_files $uri $uri/ /index.php?$uri&$args;
index index.php index.html;
}
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;
}
That worked as long as didn't active SEO-friendly URL's in XenForo.
If I activated SEO-friendly URL's, the forum main page is ok, but the server responded with a 404 for an index.html for every thread or post link.
E.g. a request for a post https://www.domain.com/posts/9876 is not answered with https://www.domain.com/threads/title-of-the-thread.123/page-3#post-9876 but with a missing https://www.domain.com/posts/9876/index.html.
Based on suggestion from Plesk support I removed the 2nd part ("location ~ \.php$ ...") and changed the first part. Now the vhost_nginx.conf looks likes this:
Code:
if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}
Now the SEO-friendly URL's are working.
But I do have some side-effects: my munin reporting (formerly available under https://www.domain.com/munin) is not available anymore, returns only a 404. The same for the plesk stats (https://www.domain.com/plesk-stat).
But the worst thing is: I have lots of errors in the log file like this:
2017/03/14 21:22:24 [error] 10031#0: *538916 "/var/www/vhosts/domain.com/httpdocs/folder/threads/thread-title.620/index.html" is not found (2: No such file or directory), client: xx.xx.xx.xxx, server: www.domain.com, request: "GET /threads/thread-title.620/ HTTP/1.1", host: "domain.com", referrer: "https://www.domain.com/forums/forum-title.30/"
So, again, everyone running the same combo and would like to share the configs ?
Any help on this is highly appreciated.
I am going crazy ^^