Ubuntu下Apache创建虚拟主机

1.cd /etc/apache2/sites-available/php

2.sudo gedit demo.conflinux

内容以下 <VirtualHost wechat_pay:80> DocumentRoot /home/lin/文档/test/ ServerName wechat_pay:80 <Directory "/home/lin/文档/test/"> Options Indexes FollowSymLinks AllowOverride All Require all granted AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>apache

3.禁用默认的虚拟主机配置 sudo a2dissite 000-default.confide

4.启用新建的虚拟主机配置 sudo a2ensite demo.conf测试

5.根据提示进行从新加载 service apache2 reloadui

6.修改系统的hosts文件,将新设定的虚拟主机域名配置进去 sudo gedit /etc/hostshtm

127.0.0.1 wechat_pay文档

7.到你指定的目录下(/home/lin/文档/test/)新建个test.phpget

8.进行浏览测试 访问http://wechat_pay/test.php域名

可参考资料: http://www.linuxidc.com/Linux/2014-06/102871p2.htm

相关文章
相关标签/搜索