server { listen 80; server_name www.your-domain.com; rewrite ^(.*)$ https://www.your-domain.com$1 permanent; } server { listen 443 ssl; server_name www.your-domain.com; ssl_certificate /home/ssl_certificate/your-domain.com.pem; ssl_certificate_key /home/ssl_certificate/your-domain.com.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_session_timeout 5m; if ( $host != 'www.your-domain.com' ) { rewrite ^(.*)$ https://www.your-domain.com$1 permanent; } root /var/www/html; index index.html index.htm index.nginx-debian.html; # server_name _; location / { proxy_pass http://127.0.0.1:8080; } }