我有一个关于查看单个post的重写规则的博客。 查看由名为view.php的文件处理。 我在我的vhostconfiguration中使用了一些重写规则,如下所示:
location /view { rewrite ^/view/([^/.]+)?/?(.*) /view1.php?pid=$1&$query_string; }
这使得URL如下所示:
http://domain.com/view/xxxx
其中xxxx是postID。 在同一页面上,我有一个社交分享插件,其中包含一个名为share.php的文件,位于与view.php文件相同的目录中。 该插件工作正常,但是我在我的日志中收到以下错误:
FastCGI sent in stderr: "Unable to open primary script: /var/www/domain.com/view/xxxx/share.php (No such file or directory)"
我猜测它与我的nginxconfiguration文件中的上述重写规则有关。 我该如何解决这个问题? 我应该在vhostconfiguration文件中为share.php文件添加特定的重写规则吗?
这是我的PHP conf:
location ~ \.php$ { root /var/www/domain.com; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_intercept_errors on; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_ignore_client_abort on; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
这里的重要参数是SCRIPT_FILENAME参数。 您可以将该行更改为$ document_root / share.php,或者,如果需要,可以使用/var/www/domain.com/share.php $ fastcgi_script_name将requestm位置用作path
问候