小编Tim*_*thy的帖子

子文件夹中的 nginx 项目

我对我的 nginx 配置感到沮丧,所以我要求帮助编写我的配置文件,以从同一根目录的子目录中提供多个项目。这不是虚拟主机,因为它们都使用相同的主机值。也许一个例子可以澄清我的尝试:

  • 请求192.168.1.1/应当成为index.php/var/www/public/
  • 请求192.168.1.1/wiki/应当成为index.php/var/www/wiki/public/
  • 请求192.168.1.1/blog/应当成为index.php/var/www/blog/public/

这些项目使用 PHP 并使用 fastcgi。

我目前的配置非常小。

server {
    listen 80 default;
    server_name localhost;

    access_log /var/log/nginx/localhost.access.log;

    root /var/www;
    index index.php index.html;

    location ~ \.php$ {
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME /var/www$fastcgi_script_name;
        include fastcgi_params;
    }
}
Run Code Online (Sandbox Code Playgroud)

我已经试过各种事情aliasrewrite,但没能得到的东西正确的FastCGI的设置。这似乎应该有比写位置的块,复制更雄辩的方式rootindexSCRIPT_FILENAME,等。

任何让我朝着正确方向前进的指针都表示赞赏。

php nginx fastcgi

12
推荐指数
2
解决办法
6万
查看次数

标签 统计

fastcgi ×1

nginx ×1

php ×1