1. 环境和需求

  win10_x64,php7,apache24,thinkphp5。 现在,我要用apache给THINKPHP的一个项目设置一个虚拟主机,需要配置。

2. 步骤

  a. 首先,找到httpd.conf(默认是在apache目录下的conf文件夹里)。找到 #Include conf/extra/httpd-vhosts.conf 所在行,去掉前面的#。 为了配置后面的虚拟配置文件。

  b. 其次,进入目录extra,找到httpd-vhosts.conf, 在文件开头添加下面的代码:

Listen 83 #给这个项目分配的端口号是83

  c. 接着,在文件末尾添加下面的代码

<VirtualHost *:83>
	DocumentRoot "O:/websites/youbangbao/public_html"
	<Directory "O:/websites/youbangbao/public_html">	
		Options FollowSymLinks ExecCGI
		AllowOverride All
		Order allow,deny
		Allow from all
		Require all granted
	</Directory>
</VirtualHost>

  d. 最后,重启apache服务器(管理员权限),就可以正常使用了。

相关文章:

  • 2022-12-23
  • 2021-05-07
  • 2021-11-17
  • 2021-12-25
  • 2021-09-24
  • 2021-11-09
猜你喜欢
  • 2021-12-11
  • 2022-12-23
  • 2021-10-23
  • 2021-10-05
  • 2022-01-28
  • 2021-11-19
  • 2022-12-23
相关资源
相似解决方案