About Windows cannot start Apache2 of phpstudy on the local calculator

  • 2020-05-06 12:07:31
  • OfStack

After baidu, I saw a shoe prompt to modify the httpd.conf file in \ phpStudy \ Apache2 \ conf \, the code is as follows:

 
<VirtualHost *:80> 
ServerAdmin webmaster@163.com 
DocumentRoot "D:\www" 
ServerName ymywz.com 
Options Indexes FollowSymLinks 
AllowOverride All 
Order allow,deny 
Allow from all 
</VirtualHost> 


Note: due to code conflict, please change the double book name above to single book name

When you restart Apache after adding the above code at the bottom of the httpd.conf file, prompt the following:

windows could not start Apache2 on the local calculator. For more information, refer to the system event log. If this is a non-Microsoft service, contact the service vendor and refer to the specific service error code 1.
I thought it was a computer problem, so I reinstalled phpstudy. After reinstallation, Apache can be started, but the problem reappears after the above code is added. At this point, I wonder if there is something wrong with the added code. After I deleted the sentence and restarted the manual labor, I made an important discovery:

After removing the "AllowOverride All" code, Apache can be restarted and the domain name is opened. I did not study the usage of this code, only know that after deleting it can be used
phpstudy locally configures the multi-domain virtual host

After starting Apache2, there was another problem: multiple sites could not be opened, prompting a 403 error.

I checked line by line against the uncommented code in the httpd.conf file. After checking and comparing with the online tutorials, one problem was found:

#Include conf/extra/ httpd-vhosts.conf the comment "#" before this code is not deleted... the purpose of this code is to open the httpd-vhosts virtual host file. Once this is done, restart Apache so that the local domain addresses are fully open.

Note: after modifying the httpd.conf file, you also need to modify the hosts file to add a local virtual domain name (the same reason you resolved the domain name dns to IP in space).

Related articles: