2.4基于VirtualHost构建安全的http服务(3)

<VirtualHost 192.168.1.100:80>
    DocumentRoot "/usr/local/apache24/htdocs/test1"
    ServerName test1.linuxidc.com
    ErrorLog "/var/log/test1/errlog"
    CustomLog "/var/log/test1/acccesslog" common
</VirtualHost>

<VirtualHost 192.168.1.100:80>
    DocumentRoot "/usr/local/apache24/htdocs/test2"
    ServerName test2.linuxidc.com
    ErrorLog "/var/log/test2/errlog"
    CustomLog "/var/log/test2/accesslog" common
</VirtualHost>8、创建网页测试文档
[root@linuxidc htdocs]# pwd
/usr/local/apache24/htdocs
[root@linuxidc htdocs]# mkdir test1 test2
[root@linuxidc htdocs]# echo "test1" > test1/index.html
[root@linuxidc htdocs]# echo "test2" > test2/index.html9、检查配置文件是否正确

[root@linuxidc ~]# apachectl -t
Syntax OK10、重启启动服务测试

[root@linuxidc ~]# /usr/local/apache24/bin/apachectl restart

[root@linuxidc ~]# curl
test1
[root@linuxidc ~]# curl
test2

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/a6322c230e509dc52d6a800fb4d5adea.html