httpd config
Seperate the config of virtualhost to individual file
1. put the vitualhost context into one file /etc/httpd/conf.d
Example:
file name: httpd-vhosts.conf
Context:
<VirtualHost *:80>
ServerName gitserver
DocumentRoot /var/www/gitweb
<Directory /var/www/gitweb>
Options ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride All
order allow,deny
Allow from all
AddHandler cgi-script cgi
DirectoryIndex gitweb.cgi
</Directory>
</VirtualHost>
Set username and password for httpd website
1, Change the context of httpd-vhosts.conf as following
<VirtualHost *:80>
ServerName gitserver
DocumentRoot /var/www/gitweb
<Directory /var/www/gitweb>
Options ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride AuthConfig
order allow,deny
Allow from all
AddHandler cgi-script cgi
DirectoryIndex gitweb.cgi
require user webuser
AuthName "AuthConfig"
AuthType Basic
AuthUserFile /etc/httpd/.htpasswd
</Directory>
</VirtualHost>
2. create username and password
htpasswd -cm /etc/httpd/.htpasswd webuser
3. restart the httpd service
service httpd restart
Comments
Post a Comment