SHARE
TWEET

Nginx SSL Reverse Proxy

a guest Oct 9th, 2019 135 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. server {
  2.     listen 443 ssl http2;
  3.     server_name example.com; # change to your domain name
  4.  
  5.     # SSL
  6.     ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # change to SSL cert path
  7.     ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # change to SSL key path
  8.  
  9.     # reverse proxy
  10.     location / {
  11.         proxy_pass http://127.0.0.1:3000; # Your web service host:port here
  12.         proxy_http_version  1.1;
  13.         proxy_cache_bypass  $http_upgrade;
  14.         proxy_set_header Upgrade        $http_upgrade;
  15.         proxy_set_header Connection         "upgrade";
  16.         proxy_set_header Host           $host;
  17.         proxy_set_header X-Real-IP      $remote_addr;
  18.         proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
  19.         proxy_set_header X-Forwarded-Proto  $scheme;
  20.         proxy_set_header X-Forwarded-Host   $host;
  21.         proxy_set_header X-Forwarded-Port   $server_port;
  22.     }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top