我有一个PHP脚本,应接受参数作为URL段如下:
wwww.site.com/apps/myapp/index.php/param1/param2
目前我有这个工作没有问题(感谢这个问题 ): www.site.com/index.php/param1/param2
然而,我有麻烦得到它的工作时,index.php是在子目录中。 到目前为止,我在nginx.conf中有这个configuration:
location / { root /var/www/html; index index.html index.htm index.php; try_files $uri $uri/ /index.php; } location /apps/myapp/ { root /var/www/html/apps/myapp; index index.html index.php; try_files $uri $uri/ /index.php; } location ~ \.php$ { fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_index index.php; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }
在我的日志中,我仍然得到这个错误: FastCGI sent in stderr: "Primary script unknown"