ubuntu - Nginx redirect http subdomains to https -


i have 1 domain 3 subdomains:

  - example.com (main domain)  - api.example.com  - blog.example.com  - support.example.com (just cname point zendesk) 

and have 3 configuration on nginx:

api

# http server server {     listen       80;     server_name  api.example.com;     return 301 https://api.example.com$request_uri; }   # https server server {     ssl          on;     listen       443;     server_name  api.example.com;      ssl_certificate apicert.crt;     ssl_certificate_key apicert.key;      #root configuration..... } 

blog

server {     listen 80;     server_name blog.example.com;      root /var/www/blog;     index index.php index.html index.htm; 

site/main domain

server {     listen 80;     listen 443 ssl;     server_name www.example.com;     return 301 https://example.com$request_uri;      location ~ \.(php|html)$ {         deny  all;     } }  server {     listen 80;     server_name example.com;     return 301 https://example.com$request_uri;      location ~ \.(php|html)$ {         deny  all;     } }  server {     ssl on;     listen 443 ssl;     ssl_certificate  mycert.crt;     ssl_certificate_key  mycert.key;     server_name example.com;      root /var/www/frontend;     ..... } 

my problem:

your web server setup strict-transport-security max-age=16070400; includesubdomains.

this tell web browser request domain using https only. if want subdomain blog accessed through insecure http, need remove includesubdomains http strict transport security (hsts) , use different browser (or clear firefox).

https://www.ssllabs.com/ssltest/analyze.html?d=alooga.com.br


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -