Skip to content

Instantly share code, notes, and snippets.

@josuedjh3
Last active February 18, 2020 14:54
Show Gist options
  • Save josuedjh3/012d472f177884af86a84d46b359fb50 to your computer and use it in GitHub Desktop.
Save josuedjh3/012d472f177884af86a84d46b359fb50 to your computer and use it in GitHub Desktop.
upstream domain_lux_staging {
server 127.0.0.1:8000;
}
server {
listen 80;
listen [::]:80;
server_name dev.domain.com www.dev.domain.com;
return 301 https://www.dev.domain.com$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name dev.domain.com www.dev.domain.com;
ssl_certificate /etc/letsencrypt/live/dev.domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/dev.domain.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/dev.domain.com/chain.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 180m;
location = /favicon.ico {
access_log off;
log_not_found off;
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location @trendig_lux_staging {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $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-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_connect_timeout 70;
proxy_send_timeout 300000;
proxy_read_timeout 300000;
proxy_pass http://domain_lux_staging;
}
location ~ [A-Z] {
set $new_request_uri $rewrite_to_lowercase;
return 301 $scheme://$http_host$new_request_uri$is_args$args;
}
location / {
try_files index.html @domain_lux_staging;
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/conf.d/.htpasswd;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment