以下是我在 /etc/apache2/sites-available 中的虚拟主机:
<VirtualHost *:80>
DocumentRoot "/var/www/roomstays/public"
ServerName roomstays
#This should be omitted in the production environment
SetEnv APPLICATION_ENV development
<Directory "/var/www/roomstays/public">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
它还在 /etc/apache2/sites-enabled 文件夹上启用
以下是我的主机文件:
127.0.0.1 localhost
127.0.0.1 roomstays
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
我在 var/www/roomstays 中配置了我的网站。但是当我进入 roomstays 时,没有打开该网站并显示以下消息:
有用!
这是该服务器的默认网页。
Web 服务器软件正在运行,但尚未添加任何内容。
虚拟主机出了什么问题。
如何为 Zend Project 设置虚拟主机:
在位置 /var/www/ 中创建名为“roomstays”的项目(文件夹)
放入文件 /etc/hosts 行:
127.0.0.1 roomstays.test
在 /etc/apache2/sites-available/ 中创建名为“roomstays.conf”的文件并放入其中:
<VirtualHost *:80>
ServerName 127.0.0.1
ServerAlias roomstays.test
DocumentRoot /var/www/roomstays/public/
SetEnv APPLICATION_ENV "development"
<Directory /var/www/roomstays/public/>
Options All
AllowOverride All
Order Allow,Deny
Allow From All
</Directory>
</VirtualHost>
将该文件“roomstays.conf”复制到位置 /etc/apache2/sites-enabled/
重新启动 apache,打开浏览器并输入“roomstays.test”,这对我有用。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)