我有一个如下所示的 NGINX 配置设置,以便访问
stg.server.org
将由PHP 5.6 (php56-php-fpm running on port 9000)
和
stg.server.org/simon/apps/
将由 提供PHP 7.3 (php-fpm running on port 9001)
但没有成功。有谁知道如何实现这一目标?
server {
listen stg.server.org:80;
server_name stg.server.org;
root /var/www/html/;
index index.php index.html index.htm;
#charset koi8-r;
access_log /var/log/nginx/access_log;
error_log /var/log/nginx/error_log error;
location / {
root /var/www/html/;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$query_string;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
root /var/www/html/;
fastcgi_pass 127.0.0.1:9000; #php-fpm PHP 5.6
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
include /etc/nginx/fastcgi_params;
}
location /simon/apps/ {
root /var/www/stg.server.org/simon/apps/;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$query_string;
location ~ \.php$ {
root /var/www/apps-stg.unep.org/simon/pims/;
try_files $uri =404
fastcgi_pass 127.0.0.1:9001; #php-fpm PHP 7.3
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}