How to add a host header to Apache

Source: Internet
Author: User

Apache Create virtual Directory

Open the Apache configuration file httpd.conf.

At the bottom, copy the following code in, save and restart the Apache server.

The code is as follows

Namevirtualhost *:80
#第一个主机, Port 80
<virtualhost *:80>

ServerAdmin admin@phpnow.org
#指向本地位置
DocumentRoot "F:wwwrootdede"
#主机名称 (Note that this is important, is your domain name, accurate input can be successful)
ServerName www..com

Serveralias ppblog.cn
#结束第一个主机配置
</VirtualHost>
#第二个主机, Port 80
<virtualhost *:80>

ServerAdmin admin@phpnow.org

DocumentRoot "F:wwwrootwordpress"

ServerName wp.ppblog.cn

Serveralias ppblog.cn

</VirtualHost>
#从这里一定要放在下面, third host, Port 80
<virtualhost *:80>

ServerAdmin admin@phpnow.org

DocumentRoot "F:wwwroothtdocs"
#表示所有的域名都可以访问
ServerName *

Serveralias *

</VirtualHost>

Create a virtual directory in another folder

DocumentRoot "E:htdocs"

Set up the virtual directory in a directory other than "F:wwwroot": "You don t have permission to access/on this server."

The solution is as follows:

Open the Apache configuration file httpd.conf.

Found it

The code is as follows

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

Amended to


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

This allows you to create a virtual directory anywhere.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.