0

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.

Web server running on nginx version: nginx/1.10.3

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

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

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 version: nginx/1.10.3

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

built with OpenSSL 1.0.1k-fips 8 Jan 2015

TLS SNI support enabled

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

Ramratan Gupta
  • 1,056
  • 3
  • 17
  • 39
  • I tried answer form this https://stackoverflow.com/a/42815312/1589444, but did not resolved me, A record for *.knexusgroup.com is on 54.235.222.119, w3.knexusgroup.com but it did not log for any domain .knexusgroup.com . It works where there is proper definition of root dir, I am not able to figure out what is issue, why I can not find root for any sub domain which is not matched to any ngiinx config. – Ramratan Gupta Oct 28 '17 at 04:16

1 Answers1

2

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

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

  2. 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.

  3. See the root on conf:

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

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

cheers

Murmel
  • 5,402
  • 47
  • 53
  • Let me see the steps you have described – Ramratan Gupta Oct 28 '17 at 08:16
  • 1
    @Uday Shiwakoli next time please keeping formatting in mind, before posting your answer. The preview is really helpful for these kind of things – Murmel Oct 28 '17 at 08:21
  • @uday-shiwakoti Thank you very much, it helps me to resolved, what I did create a new server, commented all config enabled one by one, it was one file from /etc/nginx/static/* – Ramratan Gupta Nov 01 '17 at 11:15