Php 如何修改nginx配置文件以在不同平台上运行2个项目?
我在AWS服务器(Ubuntu)上用Nginx托管了一个节点项目。现在我想在该项目的文件夹中部署一个PHP项目。有可能吗 例如: 我的节点项目位于域上-dummydomain.com 我想在-dummydomain.com/testing上主持一个PHP项目/ 这是我的配置文件Php 如何修改nginx配置文件以在不同平台上运行2个项目?,php,amazon-web-services,nginx,hosting,ubuntu-16.04,Php,Amazon Web Services,Nginx,Hosting,Ubuntu 16.04,我在AWS服务器(Ubuntu)上用Nginx托管了一个节点项目。现在我想在该项目的文件夹中部署一个PHP项目。有可能吗 例如: 我的节点项目位于域上-dummydomain.com 我想在-dummydomain.com/testing上主持一个PHP项目/ 这是我的配置文件 server { listen 80 default_server; server_name dummydomain.com; return 301 https://$host$requ
server {
listen 80 default_server;
server_name dummydomain.com;
return 301 https://$host$request_uri;
}
server {
listen 443;
server_name dummydomain.com;
root /var/www/html;
index index.html index.htm index.php;
#this is where node project runs
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass "http://127.0.0.1:5000";
}
# I want to run PHP project in this directive
location /testing {
#alias /var/www/html;
#index index.html index.php;
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
通过这些设置,我可以运行dummydomain.com/testing/,但无法运行dummydomain.com/testing/index.php或dummydomain.com/testing/testing.php或任何类型的php文件