Created
March 9, 2021 20:15
-
-
Save erolj/997f35a4fac2b13171b3e3c72cc0c9bf to your computer and use it in GitHub Desktop.
Default nginx server block for Gitea
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 80; | |
server_name git.contoh.com; | |
include snippets/letsencrypt.conf; | |
return 301 https://git.contoh.com$request_uri; | |
} | |
server { | |
listen 443 ssl http2; | |
server_name git.contoh.com; | |
proxy_read_timeout 720s; | |
proxy_connect_timeout 720s; | |
proxy_send_timeout 720s; | |
client_max_body_size 50m; | |
# Proxy headers | |
proxy_set_header X-Forwarded-Host $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_set_header X-Real-IP $remote_addr; | |
# SSL parameters | |
ssl_certificate /etc/letsencrypt/live/git.contoh.com/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/git.contoh.com/privkey.pem; | |
ssl_trusted_certificate /etc/letsencrypt/live/git.contoh.com/chain.pem; | |
include snippets/letsencrypt.conf; | |
include snippets/ssl.conf; | |
# log files | |
access_log /var/log/nginx/git.contoh.com.access.log; | |
error_log /var/log/nginx/git.contoh.com.error.log; | |
# Handle / requests | |
location / { | |
proxy_redirect off; | |
proxy_pass http://127.0.0.1:3000; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment