Apache2.4 issues regarding configuring multi-port virtual websites

WBOY
Release: 2016-08-29 08:50:51
Original
1176 people have browsed it

I have already configured one website, and now I want to change it to multiple websites. Follow the online methodApache2.4 issues regarding configuring multi-port virtual websitesApache2.4 issues regarding configuring multi-port virtual websitesApache2.4 issues regarding configuring multi-port virtual websitesDo I need to change the relevant information of the site I originally configured? Or will httpd-vhosts.conf directly overwrite the website I set in httpd.conf?

Reply content:

I have already configured one website, and now I want to change it to multiple websites. Follow the online methodApache2.4 issues regarding configuring multi-port virtual websitesApache2.4 issues regarding configuring multi-port virtual websitesApache2.4 issues regarding configuring multi-port virtual websitesDo I need to change the relevant information of the site I originally configured? Or will httpd-vhosts.conf directly overwrite the website I set in httpd.conf?

To add a virtual website, just configure it with VirtualHost in httpd.conf.

# *:80表示监听本机所有IP(需要配置有Listen 80),星号匹配所有地址,
# 因此主服务器(httpd.conf里的DocumentRoot和ServerName)将不会处理任何请求.
# 注意,第一个监听80端口VirtualHost将作为default server用于处理找不到匹配的80请求


    DocumentRoot "/path/to/default"
    ServerName localhost



    DocumentRoot "/path/to/a.com"
    ServerName a.com



    DocumentRoot "/path/to/b.com"
    ServerName b.com
Copy after login

Try modifying the hosts file
Add: 127.0.0.1 your domain name

httpd-vhosts.conf Add a VirtualHost and restart the service. The official configuration manual is very detailed. You will understand after reading it. It is really not suitable to download a wampserver3. There is a tool that automatically adds VirtualHost, so you can learn it.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!