How to add host header to apache? apache add host header method

  

apache create virtual directory

Open apache configuration file httpd.conf.

Copy the code below at the bottom, save and restart the apache server.
Code is as follows

NameVirtualHost *:80 #first host, port 80 <VirtualHost *:80>

ServerAdmin [email protected] #point to local location DocumentRoot "F:wwwrootdede" #主机名称(Note that this is very important, your domain name, accurate input can be successful) ServerName www.45it.com

ServerAlias ​​ppblog.cn #End the first host configuration </VirtualHost> #第二Hosts, port 80 <VirtualHost *:80>

ServerAdmin [email protected]

DocumentRoot "F:wwwrootwordpress"

ServerName wp.ppblog.cn < Br>

ServerAlias ​​ppblog.cn

</VirtualHost> #From here must be placed below, the third host, port 80 <VirtualHost *:80>

ServerAdmin [email protected]

DocumentRoot "F:wwwroothtdocs" # means that all domain names can access ServerName *

ServerAlias ​​*

</VirtualHost>

Creating Virtual Directories in Other Folders

DocumentRoot “E:htdocs”

Virtual The directory is created in a directory other than "F:wwwroot"; error: "You don’t have permission to access /on this server.”

The solution is as follows:

Open apache The configuration file httpd.conf.

Found
Code as follows

<Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Deny from all </Directory>

Modified to

<Directory /> Options Indexes FollowSymLinks AllowOverride None </Directory>

This will create a virtual directory anywhere.

Copyright © Windows knowledge All Rights Reserved