CentOS solves Apache configuration virtual host problem. The Apache Welcome page can be opened, but the site directory is not located

Source: Internet
Author: User

This article is used as a working record and needs to be referenced by a friend.

CENTOS7 Installation lamp Environment Tutorial Http://www.osyunwei.com/archives/7882.html

After the installation is complete, you need to configure multiple project deployments for multiple virtual host users.

Vi/etc/httpd/conf/httpd.conf

Edit the DocumentRoot directory address can be used to specify their own convenience, where I specify the habits of their own. Do not define to the user directory (root), otherwise there may be insufficient access rights.

Web site Virtual Home directory/var/web/

DocumentRoot "/var/web/"

Append at the end of the current configuration file

#include vhostnamevirtualhost *:80include "vhost/*.conf"

To explain, namevirtualhost *:80 means that all the domains configured by the virtual host are turned on for listening on 80 ports

Include "vhost/*.conf" means to introduce the current Apache directory under the vhost of all the suffixes named conf (where we later add their own multiple project sites, a project a file easy to manage)

mkdir/etc/httpd/vhost/

Create a virtual host configuration directory. Write a copy of the virtual host configuration file

Vi/etc/httpd/vhost/ceshi.conf

The following content is written in the configuration file, and the direct assignment replaces the primary name with the added item.

<virtualhost *:80> ServerName ceshi documentroot "/var/web/ceshi/wwwroot" Serveralias www.ceshi88.com Er Rorlog "/var/web/ceshi/log/error.log" Customlog "/var/web/ceshi/log/access.log" common</virtualhost>

Serveralias can be followed by multiple domain names for binding.

The bottom one is the error log, and one is the run log.

Make sure that all occurrences of the directory in this article are present and case-sensitive, otherwise 403 error, 404 error will occur. Apache welcome is also normal but unable to point to the site directory situation.



CentOS solves Apache configuration virtual host problem. The Apache Welcome page can be opened, but the site directory is not located

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.