1

I just move my setup (personal web + different services) to a more powerful server.

I copy and paste some setup I made before like my nginx configuration for 3 web site I host (my personal + 2 services as subdomain).

I try to figure it out but something wrong happend.

Let say I have my own web site xxx.com. I manage to redirect every www request to non-www (it's not working now).

Plus now when I try to hit this web site I got a redirect to my subdomain yyy.xxx.com.

I give you my two server blocks :

Main web site :

server {
       listen           80;
       listen           [::]:80;
       server_name      gfelot.xyz www.gfelot.xyz;
       return           301 https://gfelot.xyz$request_uri;
}

server {
       listen           443 ssl http2;
       listen           [::]:443 ssl http2;
       include snippets/ssl-gfelot.xyz.conf;
       include snippets/ssl-params.conf;

       server_name gfelot.xyz;

       access_log /var/log/nginx/gfelot.xyz.access.log;
       error_log /var/log/nginx/gfelot.xyz.log;

       root /var/www/html;

       index index.html index.htm index.nginx-debian.html;

       error_page 404 /404.html;
       error_page 500 502 503 504 /50x.html;

       location = /50x.html {
                root /usr/share/nginx/html;
       }

       location ~* \.css$ {
                 access_log off;
                 expires 1M;
                 add_header Pragma public;
                 add_header Cache-Control public;
                 add_header Vary Accept-Encoding;
       }
}

Transmission service :

server {
       listen           80;
       listen           [::]:80;
       server_name      dl.gfelot.xyz www.dl.gfelot.xyz;
       return           301 https://dl.gfelot.xyz$request_uri;
}

server {
       listen 443 ssl http2;
       listen [::]:443 ssl http2;
       include snippets/ssl-gfelot.xyz.conf;
       include snippets/ssl-params.conf;

       server_name dl.gfelot.xyz

       access_log off;
       error_log /var/log/nginx/dl.gfelot.xyz.log;

       location / {
                proxy_pass http://127.0.0.1:9091/web/;
                proxy_set_header Connection "";
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_pass_header X-Transmission-Session-Id;
                }

        location /rpc {
                proxy_pass http://127.0.0.1:9091/rpc;
                proxy_set_header Connection "";
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_pass_header X-Transmission-Session-Id;
                }
}

I dunno what's wrong with this configuration. And the weird thing is, it was working well before.

Ragnar
  • 2,550
  • 6
  • 36
  • 70

1 Answers1

0

Looks like you've comma separated your the server_name directive. It should be space separated.

server_name gfelot.xyz, www.gfelot.xyz;

Dwight Gunning
  • 2,485
  • 25
  • 39
  • Yes I forgot to delete it. It was just a try to see if it was changing something. BTW thank you. – Ragnar Sep 03 '16 at 14:05
  • Did that solve the problem? I think it would also be wise to get the nginx process to dump the 'live' configuration and ensure the config files are being loaded correctly. http://serverfault.com/questions/361421/dump-nginx-config-from-running-process – Dwight Gunning Sep 03 '16 at 14:12
  • No it didn't solve the issue. I will look at your link and try it. – Ragnar Sep 03 '16 at 14:35