1
I'm currently trying to make nginx work with gitbucket using following this tutorial.
Although this is the official gitbucket wiki this page is very incomplete, and i need to adapt some details from the guide for apache, mainly the prefix thing, to make gitbucket work with nginx.
So my resulting sites-available/gitbucket
is here:
server {
listen 80; # The default is 80 but this here if you want to change it.
server_name mydomain.xxx;
location /gitbucket {
proxy_pass http://localhost:8080/gitbucket;
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_connect_timeout 150;
proxy_send_timeout 100;
proxy_read_timeout 100;
proxy_buffers 4 32k;
client_max_body_size 500m; # Big number is we can post big commits.
client_body_buffer_size 128k;
}
}
When i enable gitbucket
it works, so http://mydomain.xxx/gitbucket
redirects to my gitbucket instance, but then nginx stop serving any index file i put on my /var/www/html
, and instead serves the default index page supplied when we fresh install it. And when disabling gitbucket the index from html
folder is served again.
I've tried to make a ticket on gitbucket repo but i didn't get any satisfactory reply. So can someone shed me light on this problem?
Thanks in advance!
Make sure your
sites-enabled
are read in the correct order. – Seth – 2018-07-06T05:21:20.843Sorry, i didnt understand what you mean with "correct order". I'm a bit newbie on nginx (always used apache). – Vico – 2018-07-06T06:21:39.433
You likely still have more than one file in
– Seth – 2018-07-06T08:09:53.423sites-enabled
check the content of that file. Currently you're telling nginx to respond with a block that only defines/gitbucket
. Have a look at this Digital Ocean Article: Understanding Nginx Server and Location Block Selection AlgorithmsI have.
gitbucket
(ive created) anddefault
(the one shipped with nginx). But the wiki leaves implicit i need to create a separatedsites-enabled
file to deal with gitbucket. – Vico – 2018-07-06T20:39:53.8171No. It's an example but you don't need to have a separate file. You can easily put the location block in your default file or vice versa. You're not able to have two files with the same listen and server name directive. One will always have precedence. – Seth – 2018-07-09T05:29:56.607
Ok, adding only the
location...
part of the snippet ondefault
worked for me. – Vico – 2018-07-09T14:44:01.633