Last active
April 17, 2023 05:00
-
-
Save alvonx/1a4b4026c1cbce6f20559d3555fc5893 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dynamic_default_configuration | |
# server block for http and redirect to https nginx proxy | |
server { | |
root /var/www/html; | |
# Add index.php to the list if you are using PHP | |
index index.html index.htm index.nginx-debian.html; | |
server_name SUBDOMAIN_NAME.DOMAIN_NAME; # managed by Certbot | |
location / { | |
proxy_pass DESTINATION_URL; | |
proxy_set_header Host $host; | |
# First attempt to serve request as file, then | |
# as directory, then fall back to displaying a 404. | |
# try_files $uri $uri/ =404; | |
} | |
listen [::]:443 ssl; # managed by Certbot | |
listen 443 ssl; # managed by Certbot | |
ssl_certificate /etc/letsencrypt/live/SUBDOMAIN_NAME.DOMAIN_NAME/fullchain.pem; # managed by Certbot | |
ssl_certificate_key /etc/letsencrypt/live/SUBDOMAIN_NAME.DOMAIN_NAME/privkey.pem; # managed by Certbot | |
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot | |
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot | |
}server { | |
if ($host = SUBDOMAIN_NAME.DOMAIN_NAME) { | |
return 301 https://$host$request_uri; | |
} # managed by Certbot | |
listen 80 ; | |
listen [::]:80 ; | |
server_name SUBDOMAIN_NAME.DOMAIN_NAME; | |
return 404; # managed by Certbot | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment