Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Server block to accept server ip address
- #Server block to accept www
- #Server block to redirect http to https
- # Main Server block to virtual host
- server {
- listen 443 ssl;
- listen [::]:443 ssl;
- server_name my_site;
- ssl_certificate /etc/letsencrypt/live/my_site/fullchain.pem;
- ssl_certificate_key /etc/letsencrypt/live/my_site/privkey.pem;
- ssl_trusted_certificate /etc/letsencrypt/live/my_site/chain.pem;
- root /srv/my-site/public;
- index index.html;
- error_page 502 /502.html;
- location / {
- if ($remote_addr != "my.ip.goes.here") {
- return 503;
- }
- error_page 503 @maintenance;
- location @maintenance {
- rewrite ^(.*)$ /error503.html break;
- }
- try_files $uri @proxy;
- }
- location @proxy {
- proxy_redirect off;
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection $connection_upgrade;
- proxy_set_header Proxy '';
- proxy_set_header Host $http_host;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Real-IP $remote_addr;
- set $backend http://127.0.0.1:8000;
- proxy_pass $backend;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement