- yast –i apache2 apache2-doc apache2-example pages
- service apache2 start
- chkconfig apache2 on
- 使用browser連線到www.31100173.com測試apache2是否正常運作
- vi /etc/apache2/default-server.conf
於文件末端新增兩行:
ServerName server1
ServerAdmin root@server1
- vi /etc/apache2/listen.conf
46行改為: VirtualNameHost [server IPv6 address]:80
- mkdir –p /srv/apache2/www
- mkdir /srv/apache2/mail
- mkdir /srv/apache2/public
- mkdir /srv/apache2/private
- cp /srv/www/htdocs/index.html /srv/apache2/www/index.html
- cp /srv/www/htdocs/index.html /srv/apache2/mail/index.html
- cp /srv/www/htdocs/index.html /srv/apache2/public/index.html
- cp /srv/www/htdocs/index.html /srv/apache2/private/index.html
- 將每個目錄下的index.html稍作修改以便識別
- cd /etc/apache2/vhost.d
- cp vhost.template www.31100173.com.conf
- vi www.31100173.com
做以下修改:
<VirtualHost 2002:a78:d01:0:800:27ff:fe03:b3e9:80>
ServerAdmin root@31100173.com
ServerName www.31100173.com
DocumentRoot /srv/apache2/www
ErrorLog /var/log/apache2/www.31100173.com-error_log
CustomLog /var/log/apache2/www.31100173.com-access_log combined
HostnameLookups Off
ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
Alias /public "/srv/apache2/public"
Alias /private "/srv/apache2/private"
<Directory "/srv/www/cgi-bin">
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>
<IfModule mod_userdir.c>
UserDir public_html
Include /etc/apache2/mod_userdir.conf
</IfModule>
<Directory "/srv/apache2/www">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all</Directory>
<Directory "/srv/apache2/public">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/srv/apache2/private">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
- cp www.31100173.com.conf mail.31100173.com.conf (之後做openmail才會用到)
- vi /srv/apache2/private/.htaccess
新增下列內容:AuthName "Password Required ..."
AuthType Basic
AuthUserFile /etc/htusers
require valid-user
- htpasswd2 –cm /etc/htusers amy
- htpasswd2 –m /etc/htusers boby
- 使用browser分別連入 www.31100173.com 測試是否能正常運作.限制使用者
www.31100173.com/public
www.31100173.com/private
mail.31100173.com
沒有留言:
張貼留言