Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cdwilson/507680 to your computer and use it in GitHub Desktop.
Save cdwilson/507680 to your computer and use it in GitHub Desktop.
Mac OS X Snow Leopard - /private/etc/apache2/extra/httpd-vhosts.conf
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
<VirtualHost *:80>
</VirtualHost>
<VirtualHost *:80>
ServerName git.cdwilson.us
ErrorLog "/private/var/log/apache2/git.cdwilson.us-error_log"
CustomLog "/private/var/log/apache2/git.cdwilson.us-access_log" common
SetEnv GITWEB_CONFIG "/etc/gitweb.conf"
<IFModule rewrite_module>
#
# turning on mod rewrite
RewriteEngine on
# make the front page an internal rewrite to the gitweb script
RewriteRule ^/$ /cgi-bin/gitweb.cgi [L,PT]
# make access for "dumb clients" work
RewriteRule ^/(.*\.git/(?!/?(HEAD|info|objects|refs)).*)?$ /cgi-bin/gitweb.cgi%{REQUEST_URI} [L,PT]
</IFModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
Alias /static/gitweb.css /opt/local/share/git-core/gitweb/gitweb.css
Alias /static/git-logo.png /opt/local/share/git-core/gitweb/git-logo.png
Alias /static/git-favicon.png /opt/local/share/git-core/gitweb/git-favicon.png
Alias /static/gitweb.js /opt/local/share/git-core/gitweb/gitweb.js
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAliasMatch ^/cgi-bin/((?!(?i:webobjects)).*$) "/opt/local/share/git-core/gitweb/$1"
</IfModule>
# Un-comment this to enable HTTP access to your git repositories.
# WARNING! Unless you set up access control for HTTP, this will allow
# anybody on the internet to clone your repo by typing:
# git clone http://git.example.com/repo.git
#
# DocumentRoot "/Users/git/repositories"
# <Directory "/Users/git/repositories">
# AllowOverride None
# Options None
# Order allow,deny
# Allow from all
# </Directory>
<Directory "/opt/local/share/git-core/gitweb">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment