小编Rey*_*ier的帖子

Nginx 找不到子目录,也不会在默认目录下运行 index.php

我从 Apache 更改为 Nginx,现在遇到了一些问题。

  1. 当我尝试访问任何文件夹时,例如http://devserver/monitor/web我有一个 Symfony 项目,我收到 404 错误
  2. 当我尝试访问时,http://devserver我一直收到这条消息File not found.

这是我的/etc/nginx/conf.d/default.conf文件的样子:

server {
    listen       80;
    server_name  devserver;

    location / {
        root   /var/www/html;
        index  index.php;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        include        fastcgi_params;
    }
}
Run Code Online (Sandbox Code Playgroud)

有什么问题吗?

php nginx php-fpm

4
推荐指数
1
解决办法
7946
查看次数

标签 统计

nginx ×1

php ×1

php-fpm ×1