如何调试和查找Nginx中子域的默认文档根目录? [英] How to debug and find default document root for sub domains in nginx?

查看:85
本文介绍了如何调试和查找Nginx中子域的默认文档根目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am unable debug which default document root for one of sub domain(s) configured in nginx, I have tried all valid solution described here.

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

Web server running on nginx version: nginx/1.10.3

我需要找出问题,该URL的根目录在哪里 http://w. knexusgroup.com/ http://w.knexusgroup.com/index.php打印1

Problem is I need to figure out, where is root dir for this URL http://w.knexusgroup.com/ or http://w.knexusgroup.com/index.php it prints 1

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

On /usr/share/nginx/html/index.php I have written 2.

以下是Nginx conf的一些代码段:

Below is some snippet for 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 -V

nginx版本:nginx/1.10.3

nginx version: nginx/1.10.3

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

built by gcc 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC)

使用OpenSSL 1.0.1k-fips构建

built with OpenSSL 1.0.1k-fips 8 Jan 2015

启用了TLS SNI支持

TLS SNI support enabled

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

configure arguments: --prefix=/usr/share/nginx

推荐答案

似乎您已覆盖root. 调试此类问题的步骤:

Seems you have overridden root. Steps to debug this kind of problem:

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

  1. Try to create 1 virtual host file with w.knexus.

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

Restart nginx. This time it will report duplicate entry. Pay attention on the config which is not newly created. Once you identified config, you can remove the newly created conf.

查看conf上的根目录:

See the root on conf:

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

a. There might be multiple root based on location, so make sure you are seeing right root path.

b.您可能有代理,因此可能还需要在代理应用程序内部进行进一步调试

b. You might have proxies, so it might need further debugging inside proxy app as well

欢呼

这篇关于如何调试和查找Nginx中子域的默认文档根目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆