i am trying to implement a nginx server as reverse proxy for accessing my Gogs instance. Reason is i need to access my services from work, where all but standard ports are blocked. To avoid port conflicts on my server, most serves are running on ports >1000 (and, for that matter, Gogs too, on default 3000). So i created my own vhost config to redirect to Gogs. I get the plain html site, but errors showing errors on loading images and scripts. It seems as if the Gogs itself redirect the clients to multiple subressources, for example /js, /img, /asset and /user. I then added the /js and /img paths as location to my nginx config and got the site running. However, this seems to quite a lot of work, keeping all those paths tracked and configured. Is there a way for me to serve those paths to the client via nginx without having to configure them one by one?
The Gogs and nginx instance are running on the same server, the redirect is configured via ip, no loopback like localhost or 127.0.0.1 used, even though i tried that without success.
Thanks in advance for your help and find my config below. RMG P.S: I checked different tutorials and questions, including this stackoverflow question
server {
listen 80 default_server;
server_name devsrv;
#this redirect to another server on port 80 works fine
location /nextcloud {
proxy_pass http://OTHERIP/nextcloud;
}
location /gogs/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://LOCALIP:3000/;
}
# gogs script location
location /js {
proxy_pass http://LOCALIP:3000/js;
}
# gogs image location
location /img {
proxy_pass http://LOCALIP:3000/img;
}
}