Ubuntu Nginx 搭建 Gitweb服务器
2013-04-20 14:58
381 查看
一、原因
喜欢Nginx 喜欢Git 喜欢Ubuntu
快速安装、方便使用、快乐生活
贰、安装Nginx 和 Gitweb
simba@simba-laptop:~$ sudo apt-get install nginx gitweb
三、修改Gitweb配置文件
simba@simba-laptop:~/git-repo$ vim /etc/gitweb.conf
修改或添加以下:
四、帮助Nginx执行CGI
参考:让Nginx支持CGI
五、将Gitweb安装目录链接到web主目录下
simba@simba-laptop:~$ sudo ln -s /usr/share/gitweb/ /var/www/
六、修改Nginx配置文件
#此处省略若干
server {
set $web_root /var/www/;#设置变量 web_root
listen 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 gzipped
fastcgi_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;
}
#此处省略若干...
}
七、重启Nginx
sudo nginx -s reload
喜欢Nginx 喜欢Git 喜欢Ubuntu
快速安装、方便使用、快乐生活
贰、安装Nginx 和 Gitweb
simba@simba-laptop:~$ sudo apt-get install nginx gitweb
三、修改Gitweb配置文件
simba@simba-laptop:~/git-repo$ vim /etc/gitweb.conf
修改或添加以下:
#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
参考:让Nginx支持CGI
五、将Gitweb安装目录链接到web主目录下
simba@simba-laptop:~$ sudo ln -s /usr/share/gitweb/ /var/www/
六、修改Nginx配置文件
#此处省略若干
server {
set $web_root /var/www/;#设置变量 web_root
listen 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 gzipped
fastcgi_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;
}
#此处省略若干...
}
七、重启Nginx
sudo nginx -s reload
相关文章推荐
- Ubuntu Nginx搭建Gitweb服务器
- 省略修改Ubuntu Nginx 搭建 Gitweb服务器
- Ubuntu的web服务器搭建系列之Redis(JDK+Tomcat+MySQL+Nginx+Redis+NodeJS)
- Ubuntu搭建web服务器系列之Tomcat(JDK+Tomcat+MySQL+Nginx+Redis+NodeJS)
- Ubuntu的web服务器搭建系列之MySQL(JDK+Tomcat+MySQL+Nginx+Red
- Ubuntu+Django+Nginx+uWSGI+Mysql搭建Python Web服务器
- Ubuntu的web服务器搭建系列之JDK(JDK+Tomcat+MySQL+Nginx+Redis
- Ubuntu系统上搭建gitweb(可视化)服务器
- Ubuntu的web服务器搭建系列之Nginx(JDK+Tomcat+MySQL+Nginx+Red
- Ubuntu下搭建基于apache2的gerrit+gitweb服务器
- 阿里云服务器(Ubuntu 12.04 64位)搭建 Nginx、MySQL、PHP Web服务器 (一)
- Ubuntu10.04搭建Git服务器和GitWeb
- ubuntu 16.04 下搭建git服务器(gitosis+git-daemon+gitweb)
- 阿里云服务器(Ubuntu 12.04 64位)搭建 Nginx、MySQL、PHP Web服务器 (二)
- Ubuntu的web服务器搭建系列之MySQL(JDK+Tomcat+MySQL+Nginx+Redis+NodeJS)
- 阿里云服务器(Ubuntu 12.04 64位)搭建 Nginx、MySQL、PHP Web服务器 (一)
- Ubuntu的web服务器搭建系列之MySQL(JDK+Tomcat+MySQL+Nginx+Redis+NodeJS)
- Ubuntu的web服务器搭建系列之Redis(JDK+Tomcat+MySQL+Nginx+Red
- UbuntuServer搭建Git服务器之gitdeamon和gitweb(四)
- Ubuntu14.04+gitolite+gitweb代码管理服务器搭建