Reference article: Http://www.latelee.org/using-gnu-linux/ubuntu-apache-gitweb.html http://blog.csdn.net/caspiansea/article/details/41952139 http://tom-cjp.iteye.com/blog/1005081
Installing software under Ubuntu is easy. Only need to apt-get install, do not download the source code, their own compilation. This article mainly write about the Web server building, as for the gitweb, in fact, a long time ago, in order to better promote git to do, but so far little effect. However, it is used in conjunction with Web servers and is therefore also written here.
Apache
1, first check whether the 80 port is occupied
Netstat-nap | grep 80
If there is a stop program, otherwise conflict with Apache, for example, my virtual machine has previously had boa, then to stop Boa.
2. Installing Apache
sudo apt-get install apache2
After installation, the default is already running and booting from
Restart command:
/etc/init.d/apache2 restart
If the restart Apache2 has a warning, as follows:
Could not reliably determine the server ' s fully qualified domain name, using:: 1. Set the ' ServerName ' directive globally to suppress this message
The solution is also simple, added at the end of the/etc/apache2/apache2.conf file
ServerName localhost
(Note: The localhost name is called the name on the machine, and/etc/hostname is the same)
After the installation is complete, there are a few things to improve.
1. Change the default directory
The previous old version of the apache2 default directory is WWW, but the new version becomes the/var/www/html,apache mailing list with instructions on this change, in the new version of Ubuntu and Fedora, have already used the new default directory. If you want to modify it is also easy, in the/etc/apache2/sites-available/000-default.conf file, put
Documentroot/var/www/html
Switch
Documentroot/var/www
2. Change the default home page
Generally, the default home page is the index.html file, but in some cases this is not the case, it will be modified.
Go to the/etc/apache2 directory and use the following command to find (and learn a lookup):
Grep-ir Directoryindex/etc/apache2
Locate the/etc/apache2/mods-enabled/dir.conf file, and add the desired default home page name after DirectoryIndex, as follows (the last one I added):
<ifmodule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm latelee_index.html
</IfModule>
At this point, the Web server can basically be said to be complete.
Apache2 itself records access information (my site is constantly being disturbed by spam messages, and its struggle process, analysis of access logs). You can find out by looking at Access.log.
View Access IP, and statistics:
Cat/var/log/apaches/access.log | awk ' {print '} ' | Sort-n | uniq-c | Sort-n
To view IP and access pages:
Cat/var/log/apaches/access.log | awk ' {print $ $11} '
In my work, I need to share my own business, and I use these commands to see if anyone comes to visit (in case of any passing day, I have reason to say: I have already issued the announcement, you did not see, blame who?) haha haha! )。
Gitweb
1, installation Gitweb
sudo apt-get install Gitweb
If prompted:
E:unable to fetch some archives, maybe run apt-get update or try with–fix-missing?
To execute the command sudo apt-get update
2. Set the Gitweb property
Edit/etc/gitweb.conf File
Project path (at the beginning):
$projectroot = "/home/git";
At the end add
$site _name = "Gitweb @ latelee-server";
# $site _name = "192.168.1.254 @ Git"; #gitweb首页标题栏
$feature {' Search '} {' default '} = [1];
$feature {' blame '} {' default '} = [1];
# $feature {' snapshot '} {' default '} = [' tgz ', ' tbz2′, ' zip '];
#禁止Snapshot
$feature {' snapshot '} {' default '} = [undef];
5. Improved page layout:
If the/var/www/gitweb directory is not generated
Ln-s/usr/share/gitweb//var/www/gitweb
Enter the IP directly and add Gitweb to access the Gitweb.
http://192.168.18.168/gitweb/
In this way, you can view the log and the code on the browser.
The environment described above is the latest version of the ubuntu,14.04. Some articles on the internet have been mentioned in the configuration is not suitable for the new version, so wrote this article.
Li Yu, posted on November 04, 2014 evening
configuring Gitweb on Ubuntu 14.04Category: Linux2014-12-16 02:25 1019 people read reviews (0) favorite reports
1. Install Gitweb and Apache2 first
2. Modify the configuration file (because Gitweb has a configuration file installed under/etc/apache2/conf.d/, this directory is obsolete):
[Plain] View plaincopyprint?
- sudo cp/etc/apache2/conf.d/gitweb/etc/apache2/conf-available/gitweb.conf
- Cd/etc/apache2/conf-enabled
- sudo ln-s. /conf-available/gitweb.conf
Modify the gitweb.conf as follows:
[Plain] View plaincopyprint?
- Alias/gitweb/usr/share/gitweb
- <Directory/usr/share/gitweb>
- Options +followsymlinks +execcgi
- AddHandler Cgi-script. CGI
- </Directory>
(added "+" to solve grammatical problems before followsymlinks)
3. Enable CGI:
[Plain] View plaincopyprint?
- sudo a2enmod CGI
- sudo service apache2 restart
4. Modify the/etc/gitweb.conf to add the project information:
[Plain] View plaincopyprint?
- $projectroot = "/home/charles/repo";
- $projects _list = $projectroot;
5. Create project information.
Separate the project information from the actual code.
[HTML] View plaincopyprint?
- mkdir Repo
- CD repo/
- git clone--bare ~/code/linux-3.10.28 linux-3.10.28
Then, open http://localhost/gitweb/to see the project information.
6. Because the Gitweb data source and the actual code are not in the same place, the ~/repo needs to be updated frequently.
This can be accomplished with a script:
[Plain] View plaincopyprint?
- #!/bin/bash
- CD ${home}/code/linux-3.10.28
- git remote add web/home/charles/repo/linux-3.10.28 >&/dev/null
- sudo git push-f web
If you have the following warning,
[Plain] View plaincopyprint?
- Warning:push.default is unset; Its implicit value was changing in
- Git 2.0 from ' matching ' to ' simple '. To squelch the This message
- and maintain the behavior after the default changes, use:
- git config--global push.default matching
- To squelch this message and adopt the new behavior now, use:
- git config--global push.default simple
- When Push.default was set to ' matching ', git would push local branches
- To the remote branches, which already exist with the same name.
execution
[Plain] View plaincopyprint?
- git config--global push.default matching
on the line.
Can be automated to update:
[Plain] View plaincopyprint?
- Crontab-l
- * * * * * * ${home}/foo/git.web.push
Replace Gitweb.css and gitweb.js, download items, and copy files to/usr/share/gitweb/
Java code
- git clone https://github.com/kogakure/gitweb-theme.git
join the group to see the next article:
server git
Note Three, Apache build Gitweb "Turn"