Advertisement
chuyen

config nginx

Jan 12th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 1.08 KB | None | 0 0
  1. server {
  2.   listen 80;
  3.   server_name example.com;
  4.  
  5.   location /.well-known/acme-challenge/ {
  6.     root /var/www/letsencrypt;
  7.   }
  8.  
  9.   location / {
  10.     return 301 https://$host$request_uri;
  11.   }
  12. }
  13.  
  14. server {
  15.   listen 443 ssl http2;
  16.   listen [::]:443 ssl http2;
  17.  
  18.   server_name example.com;
  19.  
  20.  
  21.   ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
  22.   ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
  23.  
  24.   ssl_dhparam  /etc/letsencrypt/live/example.com/dhparam.pem;
  25.  
  26.   location /socket.io/ {
  27.     proxy_set_header Upgrade $http_upgrade;
  28.     proxy_set_header Connection "upgrade";
  29.     proxy_pass "http://localhost:5000/socket.io/";
  30.   }
  31.  
  32.   location / {
  33.         try_files /_not_exists_ @backend;
  34.   }
  35.  
  36.   location @backend {
  37.     proxy_pass       http://127.0.0.1:5000;
  38.     proxy_set_header X-Real-IP $remote_addr;
  39.     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  40.     proxy_set_header Host $http_host;
  41.  
  42.     proxy_http_version 1.1;
  43.     proxy_set_header Upgrade $http_upgrade;
  44.     proxy_set_header Connection "upgrade";
  45.   }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement