server {listen 80;server_name gitlab.mydomain.com;root /home/gitlab/gitlab/public;# individual nginx logs for this gitlab vhostaccess_log /var/log/nginx/gitlab_access.log;error_log /var/log/nginx/gitlab_error.log;location / {# serve static files from defined root folder;.# @gitlab is a named location for the upstream fallback, see belowtry_files $uri $uri/index.html $uri.html @gitlab;}# if a file, which is not found in the root folder is requested,# then the proxy pass the request to the upsteam (gitlab unicorn)location @gitlab {proxy_redirect off;# you need to change this to "https", if you set "ssl" directive to "on"proxy_set_header X-FORWARDED_PROTO http;proxy_set_header Host gitlab.mydomain.com:80;proxy_set_header X-Real-IP $remote_addr;proxy_pass http://gitlab;}}
Hi,
On Sunday, May 13, 2012 4:24:21 PM UTC+1, Jianwen Wei wrote:Hi,I've set up a GitLab on my Scientic Linux 6.2 server and it's so awesome. Thank all the guys working for the GitLab project.I've got a question: Is it possible to host GitLab in a subdirectory of www root? So that I can get access to gitlab web via http://www.mydomain.com/gitlab/, rather than http://gitlab.mydomain.com/.I follow GitLab's official manual, setting up GitLab on gitolite and nginx. Here is nginx's core configuration, which makes GitLab service available at http://gitlab.mydomain.com/.server {listen 80;server_name gitlab.mydomain.com;root /home/gitlab/gitlab/public;# individual nginx logs for this gitlab vhostaccess_log /var/log/nginx/gitlab_access.log;error_log /var/log/nginx/gitlab_error.log;
location / {
# serve static files from defined root folder;.# @gitlab is a named location for the upstream fallback, see belowtry_files $uri $uri/index.html $uri.html @gitlab;}# if a file, which is not found in the root folder is requested,# then the proxy pass the request to the upsteam (gitlab unicorn)location @gitlab {proxy_redirect off;# you need to change this to "https", if you set "ssl" directive to "on"proxy_set_header X-FORWARDED_PROTO http;proxy_set_header Host gitlab.mydomain.com:80;proxy_set_header X-Real-IP $remote_addr;proxy_pass http://gitlab;}}Assume that my www-root lies in /var/www/html and I make a symbolic link, /var/www/html/gitlab, pointing to /home/gitlab/gitlab/public. I doubt that, whether a mere modification in nginx.conf, which changes "root /home/gitlab/gitlab/public" to "root /var/www/html", will fulfill my need.Therefore, I need your advice. Besides changing nginx serving root, is there anything I should do to make http://www.mydomain.com/gitlab/ usable? Thanks!I have the same doubt, anyone can help us?Thanks ;)
Hmm. It looks good. Nice job, Jose. I will continue to find if there's a nginx approach.