Skip to content

Instantly share code, notes, and snippets.

@yuritsuki
Last active January 19, 2024 05:38
Show Gist options
  • Save yuritsuki/a55c0dda9e99dafcf42f2850e63487bc to your computer and use it in GitHub Desktop.
Save yuritsuki/a55c0dda9e99dafcf42f2850e63487bc to your computer and use it in GitHub Desktop.
Current nginx conf for ws
# x for private info
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
gzip on;
client_max_body_size 100M;
gzip_disable "msie6";
gzip_min_length 1000;
gzip_types
application/x-javascript
application/javascript
application/json
application/xhtml+xml
application/xml
application/xml+rss
font/eot
font/otf
font/ttf
font/woff2
image/svg+xml
text/css
text/javascript
text/plain
text/html
text/xml;
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_protocols TLSv1.2 TLSv1.3;
upstream docservice {
server 192.168.10.14;
}
map $http_x_forwarded_proto $the_scheme {
default $http_x_forwarded_proto;
"" $scheme;
}
map $http_x_forwarded_host $the_host {
default $http_x_forwarded_host;
"" $host;
}
map $http_upgrade $proxy_connection {
default upgrade;
"" close;
}
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Forwarded-Host $the_host/docserver;
proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate x;
ssl_certificate_key x;
ssl_ciphers x;
server_name x;
location /api {
proxy_pass http://backend:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
real_ip_header X-Real-IP;
}
location /storage {
proxy_pass http://backend:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
real_ip_header X-Real-IP;
}
location /docserver/ {
proxy_pass http://docservice/;
proxy_http_version 1.1;
proxy_set_header Host $host;
}
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
}
server {
listen 80 default_server;
listen [::]:80;
server_name x;
return 301 https://$host$request_uri;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment