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: