A
A
alltiptop2014-05-08 17:50:24
Nginx
alltiptop, 2014-05-08 17:50:24

How to set a rule in nginx only for a subdomain?

Problem: https://domain.com redirects to http://domain.com/attempt/login/to/seafile
Given:
root domain domain.com
subdomain https://sub.domain.com/ - seafile server , their manual config via nginx:

server {
      listen       80;
      server_name  sub.domain.com; 
      rewrite ^ https://$http_host$request_uri? permanent;
  }

  server {
      listen 443;
      ssl on;
      ssl_certificate /etc/ssl/cacert.pem;
      ssl_certificate_key /etc/ssl/privkey.pem;
      server_name sub.domain.com;    
      # длинный конфиг #
      fastcgi_param   HTTPS               on;
      fastcgi_param   HTTP_SCHEME         https;
  }

1. Why does it work not only with sub.domain.com, but also tries to do something with the root domain?
2. How to fix it?
3. How to leave https://domain.com on request without redirects to seafile?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question