Kos-M / GogsThemes

An attempt to give some colors to amazing Gogs platform ..
MIT License
83 stars 8 forks source link

issue with custom url #13

Open firebird631 opened 1 year ago

firebird631 commented 1 year ago

Hi, thank for this nice theme.

There is issues when gogs is not on root of website, for examples on http://yourhost/gogs/

In that case there is many changes I applied in way to work but I am not satisfied with my solution.

Changing the inject/head.tmpl and prepend the path (in that example prepend with /gogs/ ). Then there is still issue because it doesn't look at custom/css/themes directory but look for public/css/themes. So I move the dark_themes.css into public/css/themes/

Finally modify the url( ...) path into the dark_themes.css with prepend /gogs/ in way it retrieve images.

Does someone have a better solutio ?

Kos-M commented 1 year ago

Hi , thanks i appreciate this. What issues did you have ? I have not tested in a sub dir , but i think with standard instructions , if you tweak your server settings you can make it work. For example you can create a reverse proxy of gogs running in a hidden port with root configuration as is, and forwarding requests from http://yourdomain.com/gogs to internal --> gogs service.

firebird631 commented 1 year ago

In my case it was not able to retrieve the files from custom directory, it necessary needed to move to public. I've really goes on detail, but I found nothing special on Gogs documentation.

Kos-M commented 1 year ago

I think that happened because web server of yourdomain.com thinks root is yourdomain.com/ but gogs thinks root is yourdomain.com/gogs/

You need to serve gogs with a reverse proxy , or under a virtual host in apache. Otherwise probably you will face issues with gogs in general i believe , not just with this theme.

firebird631 commented 1 year ago

Thank for your help.

In my case my nginx location :

location /gogs/ {
    proxy_pass                   http://localhost:3000/;
    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_read_timeout      90;
}

and gogs app.ini

ROOT_URL = http://servername/gogs/

Kos-M commented 7 months ago

try root url without the gogs part. and keep that nginx config the same as above. i have something similar.