Nginx only serves 1 App

Nginx-Chris nginx-forum at forum.nginx.org
Tue May 15 20:32:30 UTC 2018


Dear Moshe

I did switch off the seafile configuration and that means that the normal
chat.mydomain.com works again with nginx.,

I did then do 

> sudo certbot --nginx

and the sitechat.mydomain.com now runs on with SSL.

So then I switch seafile conf on again --> Seafile works as always.

AND mattermost on chat.mydomain.com works, but ONLY if I add https:// in
front of the web address.

So:

chat.mydomain.com <-- does only work when seafile off (then redirects)
http://chat.mydomain.com <--  does only work when seafile off (then
redirects)

https://chat.mydomain.com <-- works when seafile is on and/or off.

Why does nginx not redirect the chat.mydomain.com to https?

The new config for chat.mydomain.com is this. it got changed by certbot
automatically.

MATTERMOST:

   server 127.0.0.1:8065;
}

proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=mattermost_cache:10m
max_size=3g inactive=120m use_temp_path=off;

server { 
   server_name chat.mydomain.com;

   location ~/api/v[0-9]+/(users/)?websocket$ {
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
       client_max_body_size 50M;
       proxy_set_header Host $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_set_header X-Frame-Options SAMEORIGIN;
       proxy_buffers 256 16k;
       proxy_buffer_size 16k;
       proxy_read_timeout 600s;
       proxy_pass http://backend;
   }

   location / {
       client_max_body_size 50M;
       proxy_set_header Connection "";
       proxy_set_header Host $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_set_header X-Frame-Options SAMEORIGIN;
       proxy_buffers 256 16k;
       proxy_buffer_size 16k;
       proxy_read_timeout 600s;
       proxy_cache mattermost_cache;
       proxy_cache_revalidate on;
       proxy_cache_min_uses 2;
       proxy_cache_use_stale timeout;
       proxy_cache_lock on;
       proxy_pass http://backend;
   }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/chat.mydomain.com/fullchain.pem; #
managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/chat.mydomain.com/privkey.pem;
# managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}


server {
    if ($host = chat.mydomain.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


   
   listen 80;
   server_name chat.mydomain.com;
    return 404; # managed by Certbot

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,279794,279806#msg-279806



More information about the nginx mailing list