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>