配置apache虚拟主机具体步骤详解(配置虚拟域名指向本地主机)
2016-03-29 14:09
886 查看
配置apache虚拟主机具体步骤详解(配置虚拟域名指向本地主机)
配置虚拟域名: 1、开启apache的mod_rewrite功能模块 2、引入http-vhosts.conf文件 3、添加VirtualHost配置 具体步骤: 1、打开XAMPP->Apache->conf->httpd.conf(也可以直接从XAMPP中直接打开配置文件) 2、搜索rewrite,取消掉LoadModule rewrite_module modules/mod_rewrite.so这一行的注释。然后找到vhosts.conf,找到# Virtual hosts #Include conf/extra/httpd-vhosts.conf 这一段把Include conf/extra/httpd-vhosts.conf前面的"#"去掉。 3、在httpd.conf里的DocumentRoot "C:/xampp/htdocs"前面加上# 4、在DocumentRoot下面的Directory前面加上#,如下图: #<Directory "C:/xampp/htdocs"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch #ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- #"Options All" # doesn't give it to you. # # The Options directive is both complicated and important. #Please see # http://httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # # Options Indexes FollowSymLinks Includes ExecCGI # # AllowOverride controls what directives may be placed in #.htaccess files. # It can be "All", "None", or any combination of the keywords: # AllowOverride FileInfo AuthConfig Limit # # AllowOverride All # # Controls who can get stuff from this server. # # Require all granted #</Directory> 5、在conf/extra/httpd-vhosts.conf文件下面添加htdocs(根目录),因为上面的3、4步已经去掉了根目录配置,如下图: <VirtualHost *:80> DocumentRoot "C:/xampp/htdocs" ServerName 127.0.0.1:80 ServerAlias localhost ServerAdmin webmaster@localhost DirectoryIndex index.html index.htm index.php default.php app.php u.php ErrorLog logs/localhost_error.log CustomLog logs/localhost_access_%Y%m%d.log comonvhost <Directory "C:/xampp/htdocs"> Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost> **(一般直接进行下面两步就可以了)** 6、打开conf/extra/httpd-vhosts.conf文件,在最下方添加(为apache添加虚拟主机),如下图: <VirtualHost *:80> DocumentRoot "F:/youzhiwang" ServerName youzhiwang.com:80 ServerAlias ServerAdmin webmaster@test123.com DirectoryIndex index.html index.htm index.php default.php app.php u.php ErrorLog logs/test123.com-error.log CustomLog logs/test123.com-access_%Y%m%d.log comonvhost <Directory "F:/youzhiwang"> Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost> 7、修改修改位于(win7)c:/windows/system32/drivers/etc/目录下的hosts文件(添加本地主机域名解析) 增加一段:127.0.0.1 x.acme.com(你自己指定用来访问的域名)
相关文章推荐
- 一个关于if else容易迷惑的问题
- PHP5.2.*防止Hash冲突拒绝服务攻击的Patch
- 深入理解PHP之匿名函数
- ICANN 推迟批准 .Org 交易
- JSP/PHP基于Ajax的分页功能实现
- 黑客攻破域名注册商 Web.com 安全防线,客户私密信息或被泄露
- 关于PHP通过PDO用中文条件查询MySQL的问题。
- 什么是设计模式
- Apache Isis 1.4.0 发布,领域驱动开发框架
- PHP数据库长连接mysql_pconnect的细节
- RH436 Day3 课后总结
- Php Installing An Expansion
- dns。dhcp,ftp
- Linux快速构建apache web服务器
- Awstats处理多apache日志
- 安装perl模块小窍门
- 提高域名信任度的8个小技巧[推荐]
- 互联网业内的迷雾 谨慎选择虚拟主机
- .ME域名国内预注册开始