1.首先,找到hosts文件,C:\Windows\System32\drivers\etc\hosts,打开hosts,IP指向一个域名;
2.打开Apache配置文件 httpd.conf,位于Apache\conf目录下
搜索‘LoadModule headers_module modules/mod_headers.so’,去掉前面的#号;
搜索‘Include conf/extra/httpd-ahssl.conf’,前面加上#号;
3.Apache\conf\vhosts目录下新建conf文件,以指定域名命名,如图:
4.在新建conf文件中加入内容并保存:
<VirtualHost *:80>
DocumentRoot "D:\env\Apache\htdocs\o2o" #项目路径
ServerName shouxi.howy.com #指定域名
ServerAlias *.shouxi.com #二级域名
FcgidInitialEnv PHPRC "D:/env/PHP7" #PHP路径
FcgidWrapper "D:/env/PHP7/php-cgi.exe" .php
DirectoryIndex index.html index.php
<Directory "D:\env\Apache\htdocs\o2o">
Options FollowSymLinks ExecCGI
AllowOverride All
Require all granted
</Directory>
<LocationMatch "/(Common|Conf|Extend|images|Lang|Lib|PigCms|tpl|uploads)/(.*).(php|php5|phps|asp|aspx|jsp)$">
Require all denied
</LocationMatch>
</VirtualHost>
5.重启Apache;
6.成功。。。