I have set the settings on my server to run PHP 7.0 via nginx + php-fpm. When I access a script by name, e.g. "http://www.somedomain.com/index.php", this works correctly. However, if I access "http://www.somedomain.com/", the script is executed, but handled not by nginx + php-fpm, but by Apache. I can tell because the script is a simple phpinfo() script: when nginx handles it, the PHP version is listed as 7.0, while when Apache does it, it's listed as 5.4, which is the default PHP version on my system (OS vendor does not support anything higher).
I do not have any custom nginx or Apache directives set up on this domain. Any tips on resolving this issue?
nginx_ip_default.conf (all other nginx* .conf files are empty):
I do not have any custom nginx or Apache directives set up on this domain. Any tips on resolving this issue?
nginx_ip_default.conf (all other nginx* .conf files are empty):
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 443;
server_name somedomain.com;
return 301 https://www.somedomain.com$request_uri;
}
server {
listen XXX.XXX.XXX.XXX:443 default_server ssl;
server_name www.somedomain.com;
server_name ipv4.somedomain.com;
ssl_certificate /usr/local/psa/var/certificates/cert-XCt0Ft;
ssl_certificate_key /usr/local/psa/var/certificates/cert-XCt0Ft;
client_max_body_size 128m;
proxy_read_timeout 600;
root "/var/www/vhosts/somedomain.com/httpdocs";
access_log "/var/www/vhosts/system/somedomain.com/logs/proxy_access_ssl_log";
error_log "/var/www/vhosts/system/somedomain.com/logs/proxy_error_log";
location ^~ /plesk-site-preview/ {
proxy_pass http://127.0.0.1:8880;
proxy_set_header Host plesk-site-preview.local;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log off;
}
location / {
proxy_pass https://XXX.XXX.XXX.XXX:7081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
}
location /internal-nginx-static-location/ {
alias /var/www/vhosts/somedomain.com/httpdocs/;
add_header X-Powered-By YNginx;
internal;
}
index index.html index.cgi index.pl index.php index.xhtml index.htm index.shtml;
location ~ ^/(plesk-stat|webstat|webstat-ssl|ftpstat|anon_ftpstat|awstats-icon) {
proxy_pass https://XXX.XXX.XXX.XXX:7081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
}
location ~ ^/~(.+?)(/.*?\.php)(/.*)?$ {
alias /var/www/vhosts/somedomain.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/somedomain.com/php-fpm.sock";
include /etc/nginx/fastcgi.conf;
}
location ~ ^/~(.+?)(/.*)?$ {
proxy_pass https://XXX.XXX.XXX.XXX:7081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
}
location ~ \.php(/.*)?$ {
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass "unix:///var/www/vhosts/system/somedomain.com/php-fpm.sock";
include /etc/nginx/fastcgi.conf;
}
include "/var/www/vhosts/system/somedomain.com/conf/vhost_nginx.conf";
}
server {
server_name somedomain.com;
return 301 http://www.somedomain.com$request_uri;
}
server {
listen XXX.XXX.XXX.XXX:80 default_server;
server_name www.somedomain.com;
server_name ipv4.somedomain.com;
client_max_body_size 128m;
proxy_read_timeout 600;
root "/var/www/vhosts/somedomain.com/httpdocs";
access_log "/var/www/vhosts/system/somedomain.com/logs/proxy_access_log";
error_log "/var/www/vhosts/system/somedomain.com/logs/proxy_error_log";
location ^~ /plesk-site-preview/ {
proxy_pass http://127.0.0.1:8880;
proxy_set_header Host plesk-site-preview.local;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log off;
}
index index.php index.html index.cgi index.pl index.xhtml index.htm index.shtml;
location / {
proxy_pass http://XXX.XXX.XXX.XXX:7080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
}
location /internal-nginx-static-location/ {
alias /var/www/vhosts/somedomain.com/httpdocs/;
add_header X-Powered-By PleskNginx;
internal;
}
location ~ ^/(plesk-stat|webstat|webstat-ssl|ftpstat|anon_ftpstat|awstats-icon) {
proxy_pass http://XXX.XXX.XXX.XXX:7080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
}
location ~ ^/~(.+?)(/.*?\.php)(/.*)?$ {
alias /var/www/vhosts/somedomain.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/somedomain.com/php-fpm.sock";
include /etc/nginx/fastcgi.conf;
}
location ~ ^/~(.+?)(/.*)?$ {
proxy_pass http://XXX.XXX.XXX.XXX:7080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
}
location ~ \.php(/.*)?$ {
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass "unix:///var/www/vhosts/system/somedomain.com/php-fpm.sock";
include /etc/nginx/fastcgi.conf;
}
include "/var/www/vhosts/system/somedomain.com/conf/vhost_nginx.conf";
}
Last edited: