Note Three, Apache build Gitweb "Turn"

Source: Internet
Author: User
Tags fully qualified domain name

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?
    1. sudo cp/etc/apache2/conf.d/gitweb/etc/apache2/conf-available/gitweb.conf
    2. Cd/etc/apache2/conf-enabled
    3. sudo ln-s. /conf-available/gitweb.conf

Modify the gitweb.conf as follows:

[Plain] View plaincopyprint?
    1. Alias/gitweb/usr/share/gitweb
    2. <Directory/usr/share/gitweb>
    3. Options +followsymlinks +execcgi
    4. AddHandler Cgi-script. CGI
    5. </Directory>
(added "+" to solve grammatical problems before followsymlinks)

3. Enable CGI:

[Plain] View plaincopyprint?
    1. sudo a2enmod CGI
    2. sudo service apache2 restart

4. Modify the/etc/gitweb.conf to add the project information:

[Plain] View plaincopyprint?
    1. $projectroot = "/home/charles/repo";
    2. $projects _list = $projectroot;

5. Create project information.

Separate the project information from the actual code.

[HTML] View plaincopyprint?
    1. mkdir Repo
    2. CD repo/
    3. 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?
    1. #!/bin/bash
    2. CD ${home}/code/linux-3.10.28
    3. git remote add web/home/charles/repo/linux-3.10.28 >&/dev/null
    4. sudo git push-f web
If you have the following warning,

[Plain] View plaincopyprint?
  1. Warning:push.default is unset; Its implicit value was changing in
  2. Git 2.0 from ' matching ' to ' simple '. To squelch the This message
  3. and maintain the behavior after the default changes, use:
  4. git config--global push.default matching
  5. To squelch this message and adopt the new behavior now, use:
  6. git config--global push.default simple
  7. When Push.default was set to ' matching ', git would push local branches
  8. To the remote branches, which already exist with the same name.
execution
[Plain] View plaincopyprint?
    1. git config--global push.default matching

on the line.

Can be automated to update:

[Plain] View plaincopyprint?
    1. Crontab-l
    2. * * * * * * ${home}/foo/git.web.push

Replace Gitweb.css and gitweb.js, download items, and copy files to/usr/share/gitweb/

Java code
    1. 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"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.