nginx fails to use a subdomain :(

Cthulhux

Member
Hi.

Following issue: I have Ubuntu LTS and nginx and I want to have a subdomain ("new.domain.net"). On www.domain.net I have an old vBulletin 3.8 running which is intended to be replaced by XenForo, but I want to have a test installation of XenForo first to pull over the old data on 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:

dxbqtg.jpg


Any clues?
 
try removing the * on the listen?

EDIT: also, you should have a server_name for www as well, which you appear to be missing.
 
I can't even access XenForo yet, so this wouldn't probably work.

Removing the * and adding www didn't fix the problem. :(
 
Top Bottom