Apache service installation and configuration
Check whether Apache is installed in the host
rpm -qa | grep httpd
Install Apache command
yum -y install httpd
If installation error, please refer to Yum configuration installation https://blog.csdn.net/qq_39906884/article/details/84139028
View Apache status
systemctl status httpd.service
Start Apache
to check the status of Apache again
systemctl start httpd.service
systemctl status httpd.service
Set Apache to start on boot
systemctl enable httpd.service
View the IP address of the machine
ifconfig
Open the browser, enter the local ip address or localhost for the URL , and the following content shows that the Apache service is opened correctly
Open the firewall
http service and tick it
. Open the browser URL on another host and fill in the server ip address , you can view the same content as the server
File introduction
Apache server configuration file: /etc/httpd/conf/httpd.conf
Web site related file directory: /var/www
Web site root directory: /var/www/html
Web site log file directory: /var/log/httpd
Put the written index.html file in the root directory of the Web site: /var/www/html , and then enter the server IP in the browser to display the content of index.html
Set up personal website configuration
Modify the /etc/httpd/conf.d/userdir.conf file
to comment UserDir disabled on line 17, uncomment UserDir public_html on line 24, and
set SELinux to open access to the home directory (adding **-P** option represents permanent open)
setsebool -P httpd_enable_homedirs on
Switch users (using the dou user as an example),
create a public_html directory in the
home directory , and modify the permissions of the home directory
su - dou
chmod 755 -R /home/dou
Then restart the Apache service
systemctl restart httpd.service
Enter the browser server IP / ~ dou , displayed in the web content index.html