add example nginx config
This commit is contained in:
24
README.md
Normal file
24
README.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Gitea config
|
||||||
|
|
||||||
|
# nginx
|
||||||
|
First follow the http only nginx conf
|
||||||
|
|
||||||
|
then run
|
||||||
|
|
||||||
|
# Install certbot
|
||||||
|
sudo dnf install certbot python3-certbot-nginx
|
||||||
|
|
||||||
|
# Create webroot directory
|
||||||
|
sudo mkdir -p /var/www/certbot
|
||||||
|
|
||||||
|
# Get certificate
|
||||||
|
sudo certbot certonly --webroot \
|
||||||
|
-w /var/www/certbot \
|
||||||
|
-d git.example.com \
|
||||||
|
--email example@gmail.com \
|
||||||
|
--agree-tos \
|
||||||
|
--no-eff-email
|
||||||
|
|
||||||
|
then change the config over to the https nginx config
|
||||||
|
|
||||||
|
|
||||||
36
nginx.example/conf.d/gitea.conf
Normal file
36
nginx.example/conf.d/gitea.conf
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name git.example.com;
|
||||||
|
|
||||||
|
location /.well-known/acme-challenge/ {
|
||||||
|
root /var/www/certbot;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
server_name git.example.com;
|
||||||
|
|
||||||
|
ssl_certificate /etc/letsencrypt/live/git.example.com/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/git.example.com/privkey.pem;
|
||||||
|
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
|
||||||
|
client_max_body_size 512M;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://127.0.0.1:3000;
|
||||||
|
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;
|
||||||
|
proxy_set_header X-Forwarded-Host $host;
|
||||||
|
proxy_set_header X-Forwarded-Port $server_port;
|
||||||
|
}
|
||||||
|
}
|
||||||
14
nginx.example/conf.d/gitea.httponly.conf
Normal file
14
nginx.example/conf.d/gitea.httponly.conf
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name git.example.com;
|
||||||
|
|
||||||
|
client_max_body_size 512M;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://server:3000;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user