Windows apache下基于名字的虚拟主机配置

来源:互联网 发布:新闻投稿知乎 编辑:程序博客网 时间:2024/04/30 20:52

conf/httpd.conf文件
---------------------------------
Listen 82

ServerName localhost:82

DocumentRoot "../htdocs"

<Directory "../htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

<Directory "./htdocs/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

<Directory "./htdocs/phpweb">
    Order allow,deny
    Allow from all
</Directory>

<Directory "./htdocs/ecshop">
    Order allow,deny
    Allow from all
</Directory>

#Virtual hosts
Include conf/extra/httpd-vhosts.conf

===================================

conf/extra/httpd-vhosts.conf文件
--------------------------------
NameVirtualHost *:82

<VirtualHost *:82>
    DocumentRoot ../htdocs/
    ServerName localhost:82
    ErrorLog logs/default-error_log
</VirtualHost>

<VirtualHost *:82>
    DocumentRoot ../htdocs/phpweb
    ServerName www.phpweb.pp:82
    ErrorLog logs/phpweb-error_log
</VirtualHost>

<VirtualHost *:82>
    DocumentRoot ../htdocs/ecshop
    ServerName www.ecshop.pp:82
    ErrorLog logs/ecshop-error_log
</VirtualHost>

 

如果是在本机测试只需修改system32/drivers/etc/hosts文件

添加:

127.0.0.1 www.ecshop.pp

原创粉丝点击