apache2.4.27 Configuring a virtual Host

Source: Internet
Author: User

1: In the httpd.conf, open the line

Include conf/extra/httpd-vhosts.conf

2: Into the conf/extra/, modify the httpd-vhosts.conf


The original file is like this

<virtualhost *:80>

ServerAdmin [email protected] (email)

DocumentRoot "/WEB/WWW1" (Publish directory)

ServerName www.luo.com (domain name)

Serveralias www.luo2.com (This can be configured with multiple domain names)

Errorlog "Logs/dummy-host.example.com-error_log" (log)

Customlog "Logs/dummy-host.example.com-access_log" Common (log)

</VirtualHost>


<virtualhost *:80>

ServerAdmin [email protected]

DocumentRoot "/WEB/WWW2"

ServerName www.luo1.com

Errorlog "Logs/dummy-host2.example.com-error_log"

Customlog "Logs/dummy-host2.example.com-access_log" common

</VirtualHost>


After this configuration is still not open, show no permissions

At first glance there is no problem, but under apache-2.4.37 This configuration is complete, no access. Follow the prompts to view the directory and file permissions issues, no problem; View program error log and system log there is no obvious error; Calm down and think about it, there is no problem with the directory and file permissions, the rest is the Site Directory access permissions, So in the virtual host configuration file inside the virtual host configuration before adding such a paragraph:

<directory "Virtual Host Site Directory" >

Options Indexes FollowSymLinks includes execcgi

AllowOverride All

Require all granted

</Directory>



The configuration file is as follows

<directory "/web" >

Options Indexes FollowSymLinks includes execcgi

AllowOverride All

Require all granted

</Directory>

<virtualhost *:80>

ServerAdmin [email protected]

DocumentRoot "/WEB/WWW1"

ServerName www.luo.com

Serveralias www.luo2.com

Errorlog "Logs/dummy-host.example.com-error_log"

Customlog "Logs/dummy-host.example.com-access_log" common

</VirtualHost>


<virtualhost *:80>

ServerAdmin [email protected]

DocumentRoot "/WEB/WWW2"

ServerName www.luo1.com

Errorlog "Logs/dummy-host2.example.com-error_log"

Customlog "Logs/dummy-host2.example.com-access_log" common

</VirtualHost>


After the above modification, restart the Apache service, now can access the normal

This article is from the "Luojinsheng" blog, make sure to keep this source http://3774912.blog.51cto.com/3764912/1948908

apache2.4.27 Configuring a virtual Host

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.