只能使用域名上站、若用IP則跳空白頁
新建使用者 aaa
#useradd aaa
在 /home 下建立 null 目錄、將不合規定訪客導至此目錄
#mkdir /home/null
#chmod 755 null
#chown aaa.aaa null
編輯 index.htm 檔案放置於 /home/aaa/ 目錄下
#vi /home/aaa/index.html
- <html></html>
- <html><head>
- <meta http-equiv=refresh content="0;url=http://www.google.com/">
- </head></html>
修改 /home/aaa 權限設定
#chmod 755 aaa
編輯 httpd.conf 、取消 vhost 載入指令前面的註解
#vi /usr/local/web/apache2/conf/httpd.conf
- <Directory />
- AllowOverride none
- Require all granted
- </Directory>
- # Virtual hosts
- Include conf/extra/httpd-vhosts.conf
設定 httpd-vhosts.conf
使用IP之訪客設定
- <VirtualHost *:80>
- ServerAdmin webmaster@dummy-host.example.com
- DocumentRoot "/home/null"
- ServerName 192.168.*.*
- ErrorLog "logs/null.err"
- CustomLog "logs/null.acc" combined
- </VirtualHost>
使用正確域名訪客設定
- <VirtualHost *:80>
- ServerAdmin webmaster@dummy-host.example.com
- DocumentRoot "/home/aaa/"
- ServerName aaa.com
- ServerAlias *.aaa.com
- ErrorLog "logs/aaa.err"
- CustomLog "logs/aaa.acc" combined
- </VirtualHost>
0 意見:
張貼留言