Ubuntu Nginx搭建Gitweb伺服器

來源:互聯網
上載者:User

Ubuntu Nginx搭建Gitweb伺服器 安裝Nginx 和 Gitweb simba@simba-laptop:~$ sudo apt-get install nginx gitweb 修改Gitweb設定檔simba@simba-laptop:~/git-repo$ vim /etc/gitweb.conf 修改或添加以下:[plain]  #Git庫所處路徑  $projectroot = "/home/simba/git-repo";    #啟用追溯  $feature {'blame'}{'default'} = [1];  $feature {'blame'}{'override'} = 1;    #啟用快照(snapshot)下載  $feature {'snapshot'}{'default'} = ['zip', 'tgz'];  $feature {'snapshot'}{'override'} = 1;   協助Nginx執行CGI 將Gitweb安裝目錄連結到web主目錄下simba@simba-laptop:~$ sudo ln -s /usr/share/gitweb/ /var/www/ 修改Nginx設定檔...server {set $web_root  /var/www/;#設定變數 web_rootlisten   80 default;server_name  localhost; access_log  /var/log/nginx/localhost.access.log; location / {root   $web_root;index  index.html index.htm index.cgi;} ... location ~ .*\.cgi$ {gzip off; #gzip makes scripts feel slower since they have to complete before getting gzippedfastcgi_pass  unix:/var/run/nginx/cgiwrap-dispatch.sock;  fastcgi_index index.cgi;fastcgi_param SCRIPT_FILENAME  $web_root$fastcgi_script_name;fastcgi_param QUERY_STRING     $query_string;fastcgi_param REQUEST_METHOD   $request_method;fastcgi_param CONTENT_TYPE     $content_type;fastcgi_param CONTENT_LENGTH   $content_length;fastcgi_param GATEWAY_INTERFACE  CGI/1.1;fastcgi_param SERVER_SOFTWARE    nginx;fastcgi_param SCRIPT_NAME        $fastcgi_script_name;fastcgi_param REQUEST_URI        $request_uri;fastcgi_param DOCUMENT_URI       $document_uri;fastcgi_param DOCUMENT_ROOT      $web_root;fastcgi_param SERVER_PROTOCOL    $server_protocol;fastcgi_param REMOTE_ADDR        $remote_addr;fastcgi_param REMOTE_PORT        $remote_port;fastcgi_param SERVER_ADDR        $server_addr;fastcgi_param SERVER_PORT        $server_port;fastcgi_param SERVER_NAME        $server_name;} ...} 重啟Nginxsudo nginx -s reload

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.