Home >Backend Development >PHP Tutorial >Analyze the detailed method of writing a virtual directory for PHP in Apache_PHP tutorial

Analyze the detailed method of writing a virtual directory for PHP in Apache_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-21 15:03:56948browse

Step 1. First open the httpd.conf file in AppServApache2.2conf. Find inside:
LoadModule rewrite_module modules/mod_rewrite.so line, remove the "#" in front of it.
Step 2. Find: Include conf/extra/httpd-vhosts.conf and remove the "#" in front of it. (Very critical)
Then find:

Options FollowSymLinks ExecCGI Indexes
AllowOverride None
Order deny,allow
Deny from all
Satisfy all

Change it to:

Options FollowSymLinks ExecCGI Indexes
AllowOverride All
Order deny,allow
Deny from all
Satisfy all

But it seems that step 2 is okay without setting it during my setup process. So I think it depends.
Step 3. Still find in this file:
DocumentRoot "E:/AppServ/www/", change it to the path we want to display by default. For example:
DocumentRoot "E:/AppServ/www/www/".
Also change:
to:
.
Step 3 seems to be unnecessary. Alas, I don't understand here. During my setup. It seems that sometimes it is right not to set this. It seems like sometimes it would be wrong not to set this. It depends. It's better to set it up.
Step 4: Save the file. Then go to the httpd-vhost.conf file in AppServApache2.2confextra and open:
Change the content inside:

ServerAdmin webmaster@dummy-host2.x
DocumentRoot "C:/Apache2.2/docs/dummy-host2.x"
ServerName dummy-host2.x
ErrorLog "logs/dummy-host2.x-error.log"
CustomLog "logs/dummy -host2.x-access.log" common

This configuration is changed to:

ServerAdmin webmaster@dummy -host2.x
DocumentRoot "E:AppServwwwwww"
ServerName localhostes
ErrorLog "logs/dummy-host2.x-error.log"
CustomLog "logs/dummy-host2.x-access. log" common

Configure as many such virtual directories as there are.
Then save.
Step 5: Find the hosts file in C:WINDOWSsystem32driversetc, open:
Add at the end:
127.0.0.1 localhostes
You can specify multiple virtual names such as:
127.0.0.1 localhosts local.
Save.
You’re done.
Restart apache. Mine is appserv. I reboot. Then write in the browser:
http://localhostes. Try pressing Enter.
That’s interesting. If you don't think it looks good. Just replace localhostes with:
?
Isn’t that cool?

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327814.htmlTechArticleStep 1. First open the httpd.conf file in AppServApache2.2conf. Find the line LoadModule rewrite_module modules/mod_rewrite.so and remove the "#" in front of it. Steps...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn