我尝试设置一个运行不同路径到nginx.conf的网站,我在nginx conf下测试了3个位置,一个是node.js网络应用程序,一个是php论坛,最后一个是phpmyadmin和它工作正常。问题出在我的论坛应用上。 index.php文件在我测试时会显示502坏网关,但是当我使用index.html时它会起作用。以下是配置文件,有关此设置的任何想法?
nginx.conf
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://nodejs;
}
location /forum {
root /parent/path/of/the/folder/;
index index.php index.html;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi.conf;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
location /phpmyadmin3 {
root /usr/local/share;
index index.php;
# try_files $uri $uri/ /phpmyadmin/index.php$args$is_args;
location ~ \.php$ {
fastcgi_pass unix:/path/to/.valet/valet.sock;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
}
更新
nginx.conf
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://nodejs;
}
location /forum {
root /parent/path/of/the/folder/;
index index.php index.html;
}
location /phpmyadmin3 {
root /usr/local/share;
index index.php;
# try_files $uri $uri/ /phpmyadmin/index.php$args$is_args;
}
location ~ \.php$ {
fastcgi_pass unix:/path/to/.valet/valet.sock;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}