从nginx中的不同位置提供php文件
2022-08-30 23:34:35
						我在我的服务器上的不同目录中有我的主网站和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 404 当我尝试访问 http://mydomain/blog
 
					 
				 
				    		 
				    		 
				    		