LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   nginx - subdomain is always redirected to "www"? (https://www.linuxquestions.org/questions/linux-server-73/nginx-subdomain-is-always-redirected-to-www-4175522578/)

YesItsMe 10-18-2014 05:39 PM

nginx - subdomain is always redirected to "www"?
 
Hi.

Following issue: I have Ubuntu LTS and nginx and I want to have a subdomain ("new.domain.net"). I added an A record and a nginx config for it but it doesnt work, I'm always redirected to "www".

www.domain.net: works.
new.domain.net: redirection to www.
nww.domain.net: 404.

So I'd basically assume that DNS is propagated. It must be my configuration.

"www" config:

Code:

    server {
        listen      80;
        server_name  domain.net;
   
        root  /var/www/domain.net/public;
        index  index.html index.php;
   
        location ~ \.php$ {
            #root          html;
            fastcgi_pass  127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_read_timeout  80;
            fastcgi_param  SCRIPT_FILENAME  /var/www/domain.net/public/$fastcgi_script_name;
            include        fastcgi_params;
        }
   
        # make system internal
        location /system {
            internal;
        }
   
        # client php-fpm
        location @php-fpm {
            internal;
            fastcgi_pass  127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_read_timeout  80;
            fastcgi_param  SCRIPT_FILENAME  /var/www/domain.net/public/$fastcgi_script_name;
            include        fastcgi_params;
        }
   
        location /system {
        }
    }

"new" config:

Code:

server {
        listen *:80;
        server_name new.domain.net;
        root /var/www/new-site;
   
        location /internal_data/ {
          internal;
        }
        location /library/ {
          internal;
        }
   
        index index.html index.htm index.php index.cgi index.pl index.xhtml;
   
        location / {
            try_files $uri $uri/ /index.php?$uri&$args;
        }
   
        location ~ \.php$ {
            fastcgi_pass    127.0.0.1:9000;
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    }

GoDaddy domain config:

http://oi59.tinypic.com/dxbqtg.jpg

Any clues?

YesItsMe 10-22-2014 02:20 PM

*bump* :)

YesItsMe 10-25-2014 04:42 PM

*bump* :)

YesItsMe 10-27-2014 09:03 PM

+1 :)


All times are GMT -5. The time now is 05:38 PM.