linux下apache 配置虚拟主机
2012-10-28 15:24
549 查看
Virtual host¶
You now need to create an Apache virtual host for the application and edit yourhosts file so thathttp://zf2-tutorial.localhost will serve
index.php from thezf2-tutorial/public directory.
Setting up the virtual host is usually done within
httpd.conf orextra/httpd-vhosts.conf. If you are using
httpd-vhosts.conf, ensurethat this file is included by your main
httpd.conf file. Some Linux distributions(ex: Ubuntu) package Apache so that configuration files are stored in
/etc/apache2and create one file per virtual host inside folder
/etc/apache2/sites-enabled. Inthis case, you would place the virtual host block below into the file/etc/apache2/sites-enabled/zf2-tutorial.
Ensure that NameVirtualHost is defined and set to “*:80” or similar, and thendefine a virtual host along these lines:
<VirtualHost *:80> ServerName zf2-tutorial.localhost DocumentRoot /path/to/zf2-tutorial/public SetEnv APPLICATION_ENV "development" <Directory /path/to/zf2-tutorial/public> DirectoryIndex index.php AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
Make sure that you update your /etc/hosts orc:\windows\system32\drivers\etc\hosts file so that
zf2-tutorial.localhostis mapped to
127.0.0.1. The website can then be accessed usinghttp://zf2-tutorial.localhost.
127.0.0.1 zf2-tutorial.localhost localhost
相关文章推荐
- Linux环境下Apache配置多个虚拟主机
- 20171107L09-01老男孩Linux运维实战培训-Lamp系列-Apache服务生产实战应用指南04-基于IP的虚拟主机实战配置
- linux上apache配置虚拟主机
- linux下配置apache虚拟主机解决方案以及一些问题
- linux 下apache 配置虚拟主机
- Linux环境下Apache配置多个虚拟主机挂载多站点同时运行
- Linux下手动安装版apache配置虚拟主机
- Linux环境下Apache配置多个虚拟主机挂载多站点同时运行
- linux环境apache多端口配置虚拟主机的方法
- Linux中的DNS,Apache,虚拟主机的配置
- linux环境apache多端口配置虚拟主机的方法深入介绍
- linux下 Apache 配置虚拟主机三种方式
- linux的Apache(http)与PHP的结合配置及Apache默认虚拟主机
- Linux环境下Apache配置多个虚拟主机挂载多站点同时运行
- Linux 下Apache虚拟主机的配置
- Linux运维实战之Apache服务器的高级配置(虚拟主机、status)
- Linux环境下Apache配置多个虚拟主机挂载多站点同时运行
- LINUX系统apache基于IP,基于port和基于域名的三种虚拟主机的配置方法
- Linux中Apache与php结合以及Apache的虚拟主机配置文件
- linux下配置apache2.2+tomcat6的虚拟主机配置之tomcat-connectors