phpweb2.0 开发实战 ----- 配置虚拟主机
配置虚拟主机
apache:同一个IP不同的主机
一、加载:LoadModule rewrite_module modules/mod_rewrite.so, 去掉前面的#号。启动重写模块
二、修改文件:
应用目录下的httpd.conf文件内容如下:
<VirtualHost 127.0.0.1>
ServerName phpweb20
DocumentRoot "F:/wamp/www/phpweb20/htdocs"
<Directory "F:/wamp/www/phpweb20/htdocs">
AllowOverride All
Options All
</Directory>
php_value include_path ".;F:\wamp\www\phpweb20\include;F:\wamp\php\PEAR"(双引号、反斜杠)
php_value magic_quotes_gpc off
php_value register_globals off
SetEnv APP_CONFIG_FILE "settings.ini"
SetEnv APP_CONFIG_SECTION "development"
</VirtualHost>
三、在apache配置文件中加入:
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot F:/wamp/www
RewriteEngine Off
</VirtualHost>
同时确保listen 相应端口
四、在Apache的httpdconf中添加:
Include "f:/wamp/www/phpweb20/httpd.conf"
五、 修改C:\WINDOWS\system32\drivers\etc\hosts
127.0.0.1 localhost
127.0.0.1 phpweb20
×记得重启服务器