如何在nginx中调试和查找子域的默认文档根目录?

时间:2017-10-28 04:12:00

标签: nginx

我无法调试nginx中配置的子域之一的默认文档根目录,我已经尝试了所有有效的解决方案here

  

在nginx版本上运行的Web服务器:nginx / 1.10.3

问题是我需要弄清楚,这个网址http://w.knexusgroup.com/http://w.knexusgroup.com/index.php的根目录在哪里打印1

  

在/usr/share/nginx/html/index.php我写了2。

以下是nginx conf的一些片段:

include /etc/nginx/static/*.conf;
include /etc/nginx/saas_clients/*.conf;
index   index.php index.html index.htm;

server {
    listen       80;
    server_name  localhost;
    root         /mnt/codebase/httpdocs/saas;

    location / {
       root   /usr/share/nginx/html;
       index index.php  index.html index.htm;
    }

    # 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;
    }
    .
    .
    .
  

nginx -V

     

nginx版本:nginx / 1.10.3

     

由gcc 4.8.3 20140911(Red Hat 4.8.3-9)(GCC)构建

     

使用OpenSSL 1.0.1k-fips构建2015年1月8日

     

启用TLS SNI支持

     

配置参数: - prefix = / usr / share / nginx

1 个答案:

答案 0 :(得分:2)

似乎你已经覆盖了root。 调试此类问题的步骤:

  1. 尝试使用w.knexus创建1个虚拟主机文件。

  2. 重新启动nginx。这次它将报告重复输入。 注意不是新创建的配置。 确定配置后,您可以删除新创建的配置。

  3. 请参阅conf上的根:

    一个。根据位置可能有多个根,因此请确保您看到正确的根路径。

    湾您可能有代理,因此可能需要在代理应用程序内进一步调试

  4. 欢呼声