行业资讯

首页 > 新闻资讯 > 行业资讯 > 如何配置apache虚拟主机的实例小结

如何配置apache虚拟主机的实例小结

2025-05-17 07:22:46   来源:   阅读:

1、基于ip地址的虚拟主机

复制代码 代码如下:
Listen 80

DocumentRoot /home/1
ServerName
ErrorLog /usr/local/apache/logs/error1_log
CustomLog /usr/local/apache/logs/access1_log combined


DocumentRoot /home/2
ServerName
ErrorLog /usr/local/apache/logs/error2_log
CustomLog /usr/local/apache/logs/access2_log combined

2、基于IP 和多端口的虚拟主机配置

复制代码 代码如下:
Listen 172.20.30.40:80
Listen 172.20.30.40:8080
Listen 172.20.30.50:80
Listen 172.20.30.50:8080


DocumentRoot /www/example1-80
ServerName



DocumentRoot /www/example1-8080
ServerName


DocumentRoot /www/example2-80
ServerName
ServerAlias example1.com. *.example1.com
# Other directives here


DocumentRoot /www/example2
ServerName
DocumentRoot "E:/skydao/apache2/htdocs"
ServerName localhost
ServerAlias
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" combined


order allow,deny
allow from all


ServerAdmin kongdaoxian@gmail.com
DocumentRoot "E:/skydao/apache2/htdocs/project1"
ServerName project1.com
ServerAlias
ErrorLog "logs/project1-error.log"
CustomLog "logs/project1-access.log" combined


order allow,deny
allow from all


ServerAdmin kongdaoxian@gmail.com
DocumentRoot "E:/skydao/apache2/htdocs/zendTest/public"
ServerName zendTest.com
ServerAlias
DirectoryIndex index.php

Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all


ServerAdmin kongdaoxian@gmail.com
DocumentRoot "E:/skydao/apache2/htdocs/testRewrite"
ServerName testRewrite.com
ServerAlias
# DirectoryIndex index.php

Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all


ServerAdmin kongdaoxian@gmail.com
DocumentRoot "E:/skydao/apache2/htdocs/test"
ServerName test.com
ServerAlias
ErrorLog "logs/zendTest-error.log"
CustomLog "logs/zendTest-access.log" combined


order allow,deny
allow from all

本文《如何配置apache虚拟主机的实例小结》发布于君君营销文章,作者:admin,如若转载,请注明出处:/news/hyzx/92164.html,否则禁止转载,谢谢配合!

联系我们

18221295083
上海市浦东新区航头镇沪南公路4583号
上海市青浦区蟠龙路899号
18221295083
zhanglongfu@ijunjun.com
  • 联系我们
  • 关于我们
  • 二维码


    官方微信

    小程序
    返回
    顶部
    咨询

    扫描微信二维码,添加好友

    电话

    24小时电话:

    18221295083
    微信

    官方微信