Created
October 29, 2022 19:37
-
-
Save OfShad0ws/5302494a7734171b1b1587828a6f5ee0 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
server { | |
listen 443 http2; | |
listen [::]:443 http2; | |
server_name example.com; | |
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; | |
# set max upload size | |
client_max_body_size 512M; | |
location = /robots.txt { | |
allow all; | |
log_not_found off; | |
access_log off; | |
proxy_pass http://10.8.1.2:4433; | |
proxy_ssl_server_name on; | |
proxy_ssl_name example.com; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
} | |
location ^~ /.well-known { | |
location = /.well-known/carddav { return 301 /remote.php/dav; } | |
location = /.well-known/caldav { return 301 /remote.php/dav; } | |
location = /.well-known/acme-challenge { try_files $uri $uri/ =404; } | |
location = /.well-known/pki-validation { try_files $uri $uri/ =404; } | |
# Let Nextcloud's API for `/.well-known` URIs handle all other | |
# requests by passing them to the front-end controller. | |
return 301 /index.php$request_uri; | |
} | |
location / { | |
proxy_pass http://10.8.1.2:4433; | |
proxy_ssl_server_name on; | |
proxy_ssl_name example.com; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
} | |
} | |
server { | |
if ($host = example.com) { | |
return 301 https://$host$request_uri; | |
} | |
server_name example.com; | |
listen 80; | |
return 404; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment