Skip to content

Instantly share code, notes, and snippets.

@priesdelly
Created September 25, 2023 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save priesdelly/cc48a2db9b1d9029c2d8531cd98f835e to your computer and use it in GitHub Desktop.
Save priesdelly/cc48a2db9b1d9029c2d8531cd98f835e to your computer and use it in GitHub Desktop.
upstream upstream-service {
server spring-sv1.prod:8000;
}
server {
listen 80;
# listen [::]:80;
server_name _;
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl http2;
server_name _;
access_log /var/log/nginx/access-ssl.log;
error_log /var/log/nginx/error-ssl.log;
ssl_certificate /etc/ssl/wildcard-cert/fullchain.key;
ssl_certificate_key /etc/ssl/wildcard-cert/private.key;
# หากมีค่าก็ใส่
# ssl_prefer_server_ciphers on;
# ssl_session_cache shared:SSL:10m;
# ssl_protocols TLSv1.2 TLSv1.3;
# ssl_ciphers ;
# ปรับแต่งค่าตามที่ต้องการ
# client_max_body_size 10m;
# proxy_request_buffering off;
# proxy_buffering off;
# http2_push_preload on;
# add_header X-Frame-Options "SAMEORIGIN";
# add_header X-XSS-Protection "1; mode=block";
location / {
proxy_pass http://upstream-service;
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;
}
location = /favicon.ico {
access_log off;
log_not_found off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment