Install Apache HTTP Server on CentOS7

Source: Internet
Author: User

Install Apache HTTP Server on CentOS7

Install httpd with RPM

# Yum-yinstallhttpd // After httpd is installed, the dependent package: aprapr-utilhttpd-toolsmailcap # rpm-qihttpdName: httpdVersion: 2.4.6Release: 18 is automatically installed. protocol: x86_64InstallDate: Mon11Aug201402: 44: 55 PMCSTGroup: SystemEnvironment/DaemonsSize: 9793373 License: ASL2.0Signature: RSA/SHA256, Protocol: 21: 22 PMCST, Protocol: httpd-2.4.6-18.el7.centos.src.rpmBuildDate: Protocol: 49: 10 PMCSTBuildHost: worker1.bsys. centos. orgRelocations :( notrelocatable) Packager: CentOSBuildSystem Modify configuration file

# Cd/etc/httpd/conf # lshttpd. confmagic # cphttpd. confhttpd. conf. origin // back up the original configuration file # morehttpd. conf // check the configuration file. We noticed that the configuration is DocumentRoot "/var/www/html" // in particular, this configuration is a new default value of Apache2.4, reject all requests! <Directory/> AllowOverridenoneRequirealldenied </Directory> // set to automatic start # systemctlenablehttpd. serviceln-s '/usr/lib/systemd/system/httpd. service ''/etc/systemd/system/multi-user.target.wants/httpd. service '// In centos7, chkconfighttpdon is replaced with systemctlenablehttpdConfigure the WEB site (assuming the documents under the/wwwroot directory are used)// Create the directory structure of the two websites and test the page file # mkdir/wwwroot/www # echo "www. bigcloud. local ">/wwwroot/www/index.html # mkdir/wwwroot/crm # echo" crm. bigcloud. local ">/wwwroot/crm/index.html // configure VM host # cd/etc/httpd/# mkdirvhost-conf.d # echo" Includevhost-conf.d /*. conf "> conf/httpd. conf # vi/etc/httpd/vhost-conf.d/vhost-name.conf // Add the following content <VirtualHost *: 80> ServerNamewww. bigcloud. localDocumentRoot/wwwroot/www/</VirtualHost> <Directory/wwwroot/www/> Requireallgranted </Directory> <VirtualHost *: 80> ServerNamecrm. bigcloud. localDocumentRoot/wwwroot/crm/</VirtualHost> <Directory/wwwroot/crm/> Requireip192.168.188.0/24 // you can set access restrictions </Directory>

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.