Linux: http service to start

1, install apache

yum install httpd # When prompted, enter Y to install successfully installed

systemctl start httpd.service # start apache

systemctl stop httpd.service #停止apache

systemctl restart httpd.service #重启apache

systemctl enable httpd.service # Set apache boot

2, start the http service

httpd - Version # check whether the installation 

yum install httpd # http installation services

httpd Service Start # http service to start

service httpd status # http check service status (displays green active (running) represent a successful start)

service httpd restart # restart http service

3, the configuration file

httpd configuration file:

The main configuration file: /etc/httpd/conf/httd.conf, this is the main configuration file httpd

Extended configuration file:. /Etc/httpd/conf.d / * conf, this is an additional configuration file httpd

Document root directory: / var / www / html, this document is apache home directory, enter the show catalog page where http://127.0.0.1

Service script: /etc/rc.d/init.d/httpd 

Storage directory / var / www / error, server setting error, the requested resource access error or browser errors such as error file: Error directory

CGI directory: / var / www / cgi-bin /, preset to run CGI scripts stored in the directory

Log directory: / var / log / httpd, when the client logs httpd, log records log information stored in the directory

Script configuration file: / etc / sysconfig / httpd

Listen port: 80 / tcp, 443 / tcp

Command file: / usr / sbin / apachectl, / usr / sbin / httpd, / usr / bin / htpasswd

PID file: /var/run/httpd/httpd.pid

4, open the firewall to open port 80

View all open port numbers specified region

firewall-cmd --zone=public --list-ports

Open port (e.g., port number 80, command mode) in the designated area

firewall-cmd --zone=public --add-port=80/tcp --permanent

Restart the firewall

firewall-cmd --reload

Reference URL: https: //blog.csdn.net/u014079773/article/details/79745819

5, test page

echo “This is my first web page.”>/var/www/html/index.html

Open http://127.0.0.1 see whether the normal start

Guess you like

Origin www.cnblogs.com/why098/p/11469065.html