Skip to content

Instantly share code, notes, and snippets.

@chhaileng
Created November 13, 2019 17:37
Show Gist options
  • Save chhaileng/dd612189f0746f56627036e966146818 to your computer and use it in GitHub Desktop.
Save chhaileng/dd612189f0746f56627036e966146818 to your computer and use it in GitHub Desktop.
# Chhaileng Blog
#server {
# server_name chhaileng.com www.chhaileng.com;
# return 301 https://www.chhaileng.com$request_uri;
#}
server {
listen 80;
server_name chhaileng.com www.chhaileng.com;
server_tokens off;
location / {
#return 301 https://www.chhaileng.com$request_uri;
rewrite ^ https://www.chhaileng.com$request_uri? permanent;
}
location ~ /.well-known/acme-chhallenge {
allow all;
root /usr/share/nginx/html;
}
}
server {
listen 443 ssl http2;
server_name www.chhaileng.com;
server_tokens off;
ssl on;
ssl_buffer_size 8k;
ssl_dhparam /etc/ssl/certs/chhaileng-dhparam-2048.pem;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;
ssl_ecdh_curve secp384r1;
ssl_session_tickets off;
# OCSP stapling
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8 8.8.4.4;
ssl_certificate /etc/letsencrypt/live/chhaileng.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/chhaileng.com/privkey.pem;
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
}
# Socket Chat
upstream chat-app {
ip_hash;
server socket-chat:8080;
}
server {
listen 80;
server_name chat.chhaileng.com;
server_tokens off;
location / {
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_pass "http://chat-app";
proxy_read_timeout 120;
}
}
# Article Management System API
server {
listen 80;
server_name ams.chhaileng.com;
server_tokens off;
client_max_body_size 50M;
location / {
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_pass "http://api-ams:8080";
proxy_read_timeout 90;
}
}
# Beta Testing Web App
server {
listen 80;
server_name beta.chhaileng.com;
server_tokens off;
location / {
#root /var/www/beta/html;
#index index.html;
rewrite ^ https://beta.chhaileng.com$request_uri? permanent;
}
location ~ /.well-known/acme-chhallenge {
allow all;
root /var/www/beta/html;
}
}
server {
listen 443 ssl http2;
server_name beta.chhaileng.com;
server_tokens off;
ssl on;
ssl_buffer_size 8k;
ssl_dhparam /etc/ssl/certs/dhparam-2048.pem;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;
ssl_ecdh_curve secp384r1;
ssl_session_tickets off;
# OCSP stapling
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8 8.8.4.4;
ssl_certificate /etc/letsencrypt/live/beta.chhaileng.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/beta.chhaileng.com/privkey.pem;
location / {
root /var/www/beta/html;
index index.html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment