Apache-2.4.12 virtual host configuration problems and solutions

Source: Internet
Author: User

Apache-2.4.12 virtual host configuration problems and solutions

Configuration of multiple virtual hosts accessed by domain name in Apache-2.4.12

Original Configuration:
<VirtualHost *: 80>
ServerAdmin kk@bkjia.net
DocumentRoot "/data/cms"
ServerName www.bkjia.net
ServerAlias bkjia.net
ErrorLog "logs/www.bkjia.net-error_log"
CustomLog "logs/www.bkjia.net-access_log" common
</VirtualHost>


<VirtualHost *: 80>
ServerAdmin kk@bkjia.net
DocumentRoot "/data/bbs"
ServerName bbs.bkjia.net
ErrorLog "logs/bbs.bkjia.net-error_log"
CustomLog "logs/bbs.bkjia.net-access_log" common
</VirtualHost>


<VirtualHost *: 80>
ServerAdmin kk@bkjia.net
DocumentRoot "/data/blog"
ServerName blog.bkjia.net
ErrorLog "logs/blog.bkjia.net-error_log"
CustomLog "logs/blog.bkjia.net-access_log" common
</VirtualHost>
Can you see the error in the above multi-Virtual Host Configuration Based on Domain Name access? At first glance, there is no problem, but after this configuration is completed in apache-2.4.12, a 403 error occurs during access and no permission for access. Check the Directory and file permissions according to the prompts, and there is no problem. Check the program error log and system log without any obvious errors. Then, calm down and think about it, there is no problem with the Directory and file permissions, and the rest is the site directory access permissions. Therefore, before configuring the virtual host in the virtual host configuration file, add the following section:

<Directory "virtual host site Directory">
Options Indexes FollowSymLinks between des ExecCGI
AllowOverride All
Require all granted
</Directory>

Modify the VM configuration file as follows:

<Directory "/data">
Options Indexes FollowSymLinks between des ExecCGI
AllowOverride All
Require all granted
</Directory>
<VirtualHost *: 80>
ServerAdmin kk@bkjia.com
DocumentRoot "/data/cms"
ServerName www.bkjia.net
ServerAlias bkjia.net
ErrorLog "logs/www.bkjia.net-error_log"
CustomLog "logs/www.bkjia.net-access_log" common
</VirtualHost>


<VirtualHost *: 80>
ServerAdmin kk@bkjia.com
DocumentRoot "/data/bbs"
ServerName bbs.bkjia.net
ErrorLog "logs/bbs.bkjia.net-error_log"
CustomLog "logs/bbs.bkjia.net-access_log" common
</VirtualHost>

<VirtualHost *: 80>
ServerAdmin kk@bkjia.com
DocumentRoot "/data/blog"
ServerName blog.bkjia.net
ErrorLog "logs/blog.bkjia.net-error_log"
CustomLog "logs/blog.bkjia.net-access_log" common
</VirtualHost>

After the above modification, restart the Apache service and now it can be accessed normally!

------------------------------------- I am a split line -------------------------------------

How to enable Apache Rewrite in Ubuntu

Key points after upgrading Apache 14.04 to 2.2 in Ubuntu 2.4

Install the LAMP \ Vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04

Compile and install LAMP in CentOS 5.9 (Apache 2.2.44 + MySQL 5.6.10 + PHP 5.4.12)

Source code for Web server architecture in RedHat 5.4 build the LAMP environment and application PHPWind

Build a WEB Server Linux + Apache + MySQL + PHP in the LAMP source code Environment

-------------------------------------- Split line --------------------------------------

Apache details: click here
Apache: click here

This article permanently updates the link address:

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.