You are not logged in.

#1 2014-05-06 10:13:36

frat
Member
Registered: 2011-10-08
Posts: 32

setup gitlab with wiki,but cannot setup nginx

http://localhost:8080 is up and run ok.
but cannot access from 192.168.1.*

so i try to set up nginx,according to https://wiki.archlinux.org/index.php/Gi … nd_unicorn

Edit /etc/nginx/sites-enabled/gitlab as following:

upstream gitlab {
  server unix:/usr/share/webapps/gitlab/tmp/sockets/gitlab.socket;
}

server {
  listen *:80;         # e.g., listen 192.168.1.1:80; In most cases *:80 is a good idea
  server_name localhost;     # e.g., server_name source.example.com;
  server_tokens off;     # don't show the version number, a security best practice
  root /usr/share/webapps/gitlab/public;
  
  # Increase this if you want to upload large attachments
  # Or if you want to accept large git objects over http
  client_max_body_size 20m;

  # individual nginx logs for this gitlab vhost
  access_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 below
    try_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 {
    # If you use https make sure you disable gzip compression 
    # to be safe against BREACH attack
    # gzip off;

    proxy_read_timeout 300; # Some requests take more than 30 seconds.
    proxy_connect_timeout 300; # Some requests take more than 30 seconds.
    proxy_redirect     off;

    proxy_set_header   X-Forwarded-Proto $scheme;
    proxy_set_header   Host              $http_host;
    proxy_set_header   X-Real-IP         $remote_addr;
    proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;

    proxy_pass http://localhost:8080;
  }

  # Enable gzip compression as per rails guide: http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
  location ~ ^/(assets)/  {
    root /usr/share/webapps/gitlab/public;
    gzip_static on; # to serve pre-gzipped version
    expires max;
    add_header Cache-Control public;
  }

  error_page 502 /502.html;
}

i can open http://192.168.1.5 now,but only see the nginx default page:

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

i cannot see anything wrong with the config or the wiki directions.

Last edited by frat (2014-05-06 10:14:04)

Offline

#2 2014-05-07 01:41:17

frat
Member
Registered: 2011-10-08
Posts: 32

Re: setup gitlab with wiki,but cannot setup nginx

well,no answer here,i found out myself:
default nginx setting not include /etc/nginx/sites-enabled/*;
so the gitlab wiki missing this point.I check the nginx conf and find out this answer.

but here comes another problem,

i use

proxy_pass http://localhost:8080;

to set the  /etc/nginx/sites-enabled/gitlab working,but the nginx page only show a clean text page of gitlab without any icons,css,html decorations etc.

but everything works fine with the gitlab inner webserver on localhost:8080

I guess it's the file ownship problem or nginx redirection problem,but I can not figure out the way to fix it ,any advise will be  appreciated,thanks.

Offline

#3 2014-05-07 07:02:35

frat
Member
Registered: 2011-10-08
Posts: 32

Re: setup gitlab with wiki,but cannot setup nginx

according to this :https://github.com/gitlabhq/gitlab-recipes/tree/master/web-server/nginx

i do

sudo usermod -a -G git http
sudo chmod g+rx /home/git/

still no chage.

and i check the nginx log

2014/05/07 09:03:26 [error] 2666#0: *1 open() "/usr/share/webapps/gitlab/public/assets/application-813210a046db0add6f14de3f24064270.css" failed (2: No such file or directory), client: 192.168.1.8, server: westside.localhost, request: "GET /assets/application-813210a046db0add6f14de3f24064270.css HTTP/1.1", host: "192.168.1.8", referrer: "http://192.168.1.8/users/sign_in"
2014/05/07 09:03:26 [error] 2666#0: *5 open() "/usr/share/webapps/gitlab/public/assets/print-133dbf6c5049e528c5ed63754a3c2ae7.css" failed (2: No such file or directory), client: 192.168.1.8, server: westside.localhost, request: "GET /assets/print-133dbf6c5049e528c5ed63754a3c2ae7.css HTTP/1.1", host: "192.168.1.8", referrer: "http://192.168.1.8/users/sign_in"
2014/05/07 09:03:26 [error] 2666#0: *1 open() "/usr/share/webapps/gitlab/public/assets/application-c829d5570fd54ca20cb3a55ba2620093.js" failed (2: No such file or directory), client: 192.168.1.8, server: westside.localhost, request: "GET /assets/application-c829d5570fd54ca20cb3a55ba2620093.js HTTP/1.1", host: "192.168.1.8", referrer: "http://192.168.1.8/users/sign_in"
2014/05/07 09:03:26 [error] 2666#0: *1 open() "/usr/share/webapps/gitlab/public/assets/favicon-220424ba6cb497309f8faf8545eb5408.ico" failed (2: No such file or directory), client: 192.168.1.8, server: westside.localhost, request: "GET /assets/favicon-220424ba6cb497309f8faf8545eb5408.ico HTTP/1.1", host: "192.168.1.8"
2014/05/07 09:03:30 [error] 2666#0: *1 open() "/usr/share/webapps/gitlab/public/assets/application-813210a046db0add6f14de3f24064270.css" failed (2: No such file or directory), client: 192.168.1.8, server: westside.localhost, request: "GET /assets/application-813210a046db0add6f14de3f24064270.css HTTP/1.1", host: "192.168.1.8", referrer: "http://192.168.1.8/users/sign_in"
2014/05/07 09:03:30 [error] 2666#0: *5 open() "/usr/share/webapps/gitlab/public/assets/print-133dbf6c5049e528c5ed63754a3c2ae7.css" failed (2: No such file or directory), client: 192.168.1.8, server: westside.localhost, request: "GET /assets/print-133dbf6c5049e528c5ed63754a3c2ae7.css HTTP/1.1", host: "192.168.1.8", referrer: "http://192.168.1.8/users/sign_in"
.......

where is the .../public/assets? i checked in /usr/share/webapps/gitlab/public ,there is no assets file folder.

then where does the localhost:8080 get the assets files while the is no assets folder in  /usr/share/webapps/gitlab/public?

Offline

Board footer

Powered by FluxBB