【发布时间】:2012-09-02 09:11:40
【问题描述】:
我正在尝试将 WordPress 博客迁移到我网站的子目录(即 example.com/blog/)。使用 NginX 和 FastCGI,我设法让整个 WordPress 站点在端口 8080 上运行,但是当我尝试应用规则将其放置在 /blog 中时,我得到“未指定输入文件”
我认为因为我可以让 PHP 和 WordPress 工作,我可以假设我的安装或相关文件夹的权限没有问题。
这就是我的虚拟主机的样子(我在“/”处运行一个 rails 站点):
server {
listen 80;
server_name example.com localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location /blog/ {
root /home/deploy/www/blog.example.com/html;
index index.php;
try_files $uri $uri/ /blog/index.php;
}
location ~ \.php$ {
root /home/deploy/www/blog.example.com/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location / {
root /home/deploy/www/example.com/public;
passenger_enabled on;
index index.html index.htm;
}
我也尝试过这种配置以获得相同的结果:
location ~ ^/blog/.*(\.php)?$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
root /home/deploy/www/blog.example.com/html;
try_files $uri =404;
# fastcgi_split_path_info ^(/blog/.+\.php)(.*)$;
#fastcgi_split_path_info ^(.+\.php)(/.+)$;
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_intercept_errors on;
fastcgi_pass 127.0.0.1:9000;
}
我做错了什么?
【问题讨论】:
-
运气好吗?我遇到了一个子目录安装的问题,其中 WP 的一些 url 错误地指向 root
-
也许“C”没有在 php.ini variables_order 指令中定义?什么 phpinfo() 显示? php.net/manual/en/ini.core.php#ini.variables-order
标签: php wordpress nginx fastcgi