【发布时间】:2011-01-15 06:47:52
【问题描述】:
我的主网站和 wordpress 在我使用 nginx 作为 Web 服务器的服务器上的不同目录中。主网站位于 /home/me/www 中,而 Wordpress 位于 /home/me/wordpress 中。出于特定原因,我需要以这种方式将它们放在单独的目录中。如何在 nginx 配置文件中指定这个?我目前有以下,但它不起作用:
location / {
root /home/me/www;
index index.php index.html index.htm;
}
location /blog {
root /home/me/wordpress;
index index.php index.html index.htm;
}
location ~ \.php$ {
set $php_root /home/me/www;
if ($request_uri ~ /blog) {
set $php_root /home/me/wordpress;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
当我尝试访问 http://mydomain/blog 时,它当前返回 HTTP 404
【问题讨论】:
标签: php configuration nginx