我正试图将一个WordPress博客迁移到我网站的子目录中(例如.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;
}
我做错了什么?
你在多站点使用WordPress吗?
我不清楚你的设置,但这个列表中的教程肯定会帮助你:http://rtcamp.com/wordpress-nginx/tutorial
如果你能分享更多的细节,我可以更好地指导你。
8080是从哪里出现的?将Nginx与Apache一起使用??
"未指定输入文件"看起来像是一个与PHP文件位置不正确有关的错误。。。
尝试更改
enter code here
fastcgi_index index.php;
至
try_files index.php blog/index.php
假设"博客"是你移动WordPress的文件夹。