Changes

From Amahi Wiki
Jump to: navigation, search
513 bytes added ,  11:51, 13 March 2012
no edit summary
== Setup==
<ul><li>Create web app ([http:[Advanced_Settings|Advanced Settings]] must be enabled on HDA)</li><ol><li>From the Dashboard main page, select '''Apps''' at the top.</li><li>Choose ''Webapps''</li><li>Select '''New Web App''' button at the bottom</wiki.amahi.orgli><li>Enter ''gitweb'' for the Name (ensure the path reflects the name correctly)</index.phpli><li>Choose '''Create'''</li><li>[[Open_Terminal_as_root |Open a terminal as root]] user and do the following:{{Code|cd /etc/httpd/conf.d}}</li><li>Look for the ''####-gitweb.conf'' (#### is some number, i.e. 1000) file and open it in your favorite editor. Remove the text between '''ServerAlias''' and the last two lines, then add the following{{Text|Text=Alias /git /var/hda/web-apps/gitweb/html/RewriteEngine OnRewriteRule ^git$ git/ [R]DirectoryIndex gitweb.cgiSetEnv GITWEB_CONFIG "/etc/gitweb.conf"AddHandler cgi-script .cgi /etc/httpd/conf.d/git.conf <Directory /var/hda/web-apps/gitweb/html> RewriteEngine On RewriteBase /git/ RewriteRule ^$ gitweb.cgi [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) gitweb.cgi/$1 [QSA,L]</Directory>}}</li><li>Restart web server to enable the changes{{Code|/etc/init.d/httpd restart;}}</li><li>Create web page to browse repository</li>{{Code|cd /var/hda/web-apps/gitwebecho '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><title>Your Page Title</title><meta http-equiv="REFRESH" content="0;url=http://git/git/"></HEAD><BODY>Optional page text here.</BODY></HTML>' > html/index.htmlchown apache.users html/index.html}}</ol>
* Install dependencies
{{Code|yum -y install git git-daemon gitweb}}
$my_uri = "http://gitweb/git/";
$home_link = "http://gitweb/git/;"}}</blockquote>
* Create custom index.html file
{{Code|cd /var/hda/web-apps/gitweb
vi html/index.html}}
<blockquote>
{{Text|Text=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Your Page Title</title>
<meta http-equiv="REFRESH" content="0;url=http://git/git/"></HEAD>
<BODY>
Optional page text here.
</BODY>
</HTML>}}</blockquote>
* Copy web files and set permissions
{{Code|cp -r /var/www/git/* html
chown -R apache:users html}}
* Modify the web app configuration file as follows
{{Code|vi /etc/httpd/conf.d/####-gitweb.conf}}
<blockquote>
{{Text|Text=Alias /git /var/hda/web-apps/gitweb/html/
RewriteEngine On
RewriteRule ^git$ git/ [R]
DirectoryIndex gitweb.cgi
SetEnv GITWEB_CONFIG "/etc/gitweb.conf"
AddHandler cgi-script .cgi
 
/etc/httpd/conf.d/git.conf
<Directory /var/hda/web-apps/gitweb/html>
RewriteEngine On
RewriteBase /git/
RewriteRule ^$ gitweb.cgi [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) gitweb.cgi/$1 [QSA,L]
</Directory>}}</blockquote>
* Restart Apache
{{Code|/etc/init.d/httpd restart}}
==Complete==
12,424

edits