Call gitea as a subdomain of nginx

Once you have it set up, it should be fairly easy to set up a subdomain which simply is a reverse proxy to gitea. For instance, this is the nginx config of my gitea instance.

server {
        listen 80;
        server_name zxq.co www.zxq.co;
        root /home/git/gf/public/;
        # set max upload to 5 mb
        client_max_body_size 5M;
        client_body_buffer_size 256K;

        location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_max_temp_file_size 0;
                proxy_pass http://localhost:3000;
        }

    listen 443 ssl http2;
    # SSL SETTINGS (left out)
}
1 Like