主配置类
[root@lxb ~]# cat /etc/httpd/conf.d/host.conf
#ip地址访问
<VirtualHost 192.168.220.100:80>
ServerAdmin ip/100
DocumentRoot "/www/ip/100"
ErrorLog "/var/log/httpd/host.com-error_log"
CustomLog "/var/log/httpd/host.com-access_log" common
</VirtualHost>
<Directory "/www/ip/100">
AllowOverride None
Options None
Require all granted
</Directory>
<VirtualHost 192.168.220.200:80>
ServerAdmin ip/200
DocumentRoot "/www/ip/200"
ErrorLog "/var/log/httpd/host.com-error_log"
CustomLog "/var/log/httpd/host.com-access_log" common
</VirtualHost>
<Directory "/www/ip/200">
AllowOverride None
Options None
Require all granted
</Directory>
#端口号访问
listen 800
<VirtualHost 192.168.220.234:800>
ServerAdmin port800
DocumentRoot "/www/port/800"
ErrorLog "/var/log/httpd/host.com-error_log"
CustomLog "/var/log/httpd/host.com-access_log" common
</VirtualHost>
<Directory "/www/port/800">
AllowOverride None
Options None
Require all granted
</Directory>
listen 1000
<VirtualHost 192.168.220.234:1000>
ServerAdmin port1000
DocumentRoot "/www/port/1000"
ErrorLog "/var/log/httpd/host.com-error_log"
CustomLog "/var/log/httpd/host.com-access_log" common
</VirtualHost>
<Directory "/www/port/1000">
AllowOverride None
Options None
Require all granted
</Directory>
#缓存访问
<VirtualHost 192.168.220.235>
ServerAdmin port800
DocumentRoot "/www/name"
ErrorLog "/var/log/httpd/host.com-error_log"
CustomLog "/var/log/httpd/host.com-access_log" common
</VirtualHost>
<Directory "/www/name">
AllowOverride None
Options None
Require all granted
</Directory>
基于密码
[root@lxb ~]# cat /etc/httpd/conf.d/host1.conf
listen 22222
<virtualhost 192.168.220.250:22222>
servername zuoye
DocumentRoot "/www/http"
alias /mimi /www/secret
</virtualhost>
<directory "/www/http">
AllowOverride None
#Options None
Require all granted
</directory>
<directory "/www/secret">
authtype basic
authname "please"
authuserfile /mima
Require user xiaoming
</directory>