我在使用nginx服务器上的子目录时遇到了一些问题.
我正在使用nginx将wordpress安装作为web根目录,并尝试在子目录中运行其他php应用程序.Wordpress运行正常,但我不能为我的生活让应用程序在没有404,403或"未指定输入文件"的子目录中运行.各种配置错误.我确信有一些明显的东西,但我似乎无法弄明白!
这是相关的配置:
任何帮助将不胜感激!
server {
listen myserver.edu:8081;
server_name myserver.edu:8081;
try_files $uri $uri/ /index.php;
location / {
root /path/to/nginx/html/wordpress;
index index.php;
}
location /stacks {
alias /another/path/to/usr/local/share/stacks/php;
index index.php;
}
location ~ \.php$ {
set $php_root /path/to/nginx/html/wordpress;
include fastcgi_params;
fastcgi_pass localhost:8082;
fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name;
}
location ~ \stacks.php$ {
set $php_root /another/path/to/usr/local/share/stacks/php;
include fastcgi_params;
fastcgi_pass localhost:8082;
fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name;
}
Run Code Online (Sandbox Code Playgroud)