PHP7-3-9安装配置与Apache虚拟主机的配置

1.配置电脑系统环境变量

  在系统变量/Path中,添加 D:webserverphpphp739  D:webserverphpphp739ext两行即可

2.Apache虚拟主机配置

  先开启Apache的重定向,Apache配置文件httpd.conf,搜索: LoadModule rewrite_module modules/mod_rewrite.so ,如果前面有#,就h把#去掉。

  打开其他服务器不需要这么操作;

  根据Apache配置文件httpd.conf中的# Virtual hosts
  Include conf/extra/httpd-myvhosts.conf 这行代码,判断你需要修改的的httpd-myvhosts.conf文件,我的文件目录是

 D:webserverapacheApache2441confextra httpd-myvhosts.conf ,打开之后

 ---------------------------------------------------------------------------------------- 根据你自己的目录,进行修改      
  <VirtualHost 127.0.0.2>
    #管理员联系方式
    #ServerAdmin admin@fw.local
    #web根目录
    DocumentRoot D:/webserver/www/tp6/public
    #主机名
    ServerName tp6.com
    #目录默认文件
    DirectoryIndex index.php index.html abc.jsp

    #日志
   #ErrorLog "D:/webserver/www/20191229/logs/tp6.txt"
   #CustomLog "D:/webserver/www/20191229/logs/tp6.txt" common

    #web根目控制
    <Directory "D:/webserver/www/tp6/public">
        #控制列表的显示
        Options +Indexes +FollowSymlinks
        #允许服务器被重写
        AllowOverride All
        #允许所有请求访问资源granted/denied
        Require all granted
    </Directory>
</VirtualHost>                                                                         

------------------------------------------------------------------------------------------

然后打开C:WindowsSystem32driversetchosts ,添加你在httpd-myvhosts.conf文件中的ip地址和 主机名

我是这么写的:      127.0.0.2       tp6.com
然后保存,如果保存失败的话,先把hosts文件拉到桌面上,然后修改保存,再拉回去原来的路径即可完成保存,

重启apache之后再浏览器输入你的主机名,即可完成虚拟主机的配置。


我的文件目录是

  D:webserver

  D:webserverapache

  D:webservermariadb

  D:webserverphpphp739

  D:webserverwww p6

  D:webserverwwwlocal

原文地址:https://www.cnblogs.com/79524795-Tian/p/13588499.html