Home > Article > Backend Development > How to set up a site in php
How to set up the site in php: first open the file [httpd-vhosts.conf] and add the relevant code; then find the file [httpd.conf] and remove the [#] before [#Include conf/] ;Finally set the site name.
php method to set up the site:
1. First open apache\httpd-2.4.39-win64- In the httpd-vhosts.conf
file under the VC15\Apache24\conf\extra folder, add the following code at the end, and modify the parameters according to the comments.
#站点,8089为端口号名称 <VirtualHost *:8089> #站点名、服务器名 ServerName localhost #站点位置 DocumentRoot "E:\ProjectWork\phpProject" <Directory "E:\ProjectWork\phpProject"> #当请求没有指定文件的时候,显示目录 Options Indexes #启用文件夹访问控制的文件.htaccess设置 AllowOverride All Order allow,deny allow from all #请求控制 Require all granted #默认页面,第一个最优先 DirectoryIndex index.php index.html </Directory> </VirtualHost>
2. Find the httpd.conf
file under the apache\httpd-2.4.39-win64-VC15\Apache24\conf file and #Include conf/extra/httpd-vhosts.conf Remove the # in front, which means it is enabled. Use the conf/extra/httpd-vhosts.conf file.
3. At the end of the C:\Windows\System32\drivers\etc\hosts file, find it as shown in the figure below
4. The site configuration is completed.
Related learning recommendations: php programming (video)
The above is the detailed content of How to set up a site in php. For more information, please follow other related articles on the PHP Chinese website!