Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Problems and Solutions of Virtual Host configuration in apache-2.4.12

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Apache-2.4.12 multi-virtual host configuration based on domain name access

Original configuration:

ServerAdmin kk@etiantian.org

DocumentRoot "/ data/cms"

ServerName www.etiantian.org

ServerAlias etiantian.org

ErrorLog "logs/www.etiantian.org-error_log"

CustomLog "logs/www.etiantian.org-access_log" common

ServerAdmin kk@etiantian.org

DocumentRoot "/ data/bbs"

ServerName bbs.etiantian.org

ErrorLog "logs/bbs.etiantian.org-error_log"

CustomLog "logs/bbs.etiantian.org-access_log" common

ServerAdmin kk@etiantian.org

DocumentRoot "/ data/blog"

ServerName blog.etiantian.org

ErrorLog "logs/blog.etiantian.org-error_log"

CustomLog "logs/blog.etiantian.org-access_log" common

Can you see what's wrong with the above multi-virtual host configuration based on domain name access? At first glance, there is no problem, but when configured in this way under apache-2.4.12, there is a 403 error in access and no permission to access it. According to the prompt, there is no problem with the permission of the directory and file, and there is no obvious error in viewing the program error log and system log. Then calm down and think carefully that there is no problem with the directory and file permissions. Then the rest is the site directory access permission, so add this paragraph before the virtual host configuration in the virtual host configuration file:

Options Indexes FollowSymLinks Includes ExecCGI

AllowOverride All

Require all granted

Further modifications to the virtual host configuration file are as follows:

Options Indexes FollowSymLinks Includes ExecCGI

AllowOverride All

Require all granted

ServerAdmin kk@etiantian.com

DocumentRoot "/ data/cms"

ServerName www.etiantian.org

ServerAlias etiantian.org

ErrorLog "logs/www.etiantian.org-error_log"

CustomLog "logs/www.etiantian.org-access_log" common

ServerAdmin kk@etiantian.com

DocumentRoot "/ data/bbs"

ServerName bbs.etiantian.org

ErrorLog "logs/bbs.etiantian.org-error_log"

CustomLog "logs/bbs.etiantian.org-access_log" common

ServerAdmin kk@etiantian.com

DocumentRoot "/ data/blog"

ServerName blog.etiantian.org

ErrorLog "logs/blog.etiantian.org-error_log"

CustomLog "logs/blog.etiantian.org-access_log" common

After the above modifications, restart the apache service, and now you can access it normally. Ha ha, the big function is complete!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report