Centos 7.4 Server installation apache and solutions to problems arising during installation
- 2021-01-02 22:08:19
- OfStack
The example of this article describes es1EN 7.4 server installation apache and the problem solving methods during installation. To share for your reference, the details are as follows:
1. Install httpd
1. Before installation, check whether the httpd. rpm package has been installed in the system; if not, it is not installed; if yes, delete the corresponding rpm package name of ES10en-ES11en
#rpm -qa | grep httpd
2. yum installation (automatic installation of dependent packages) is simple and convenient
#yum -y install httpd
3. After successful installation, ES20en-ES21en checks the installed VERSION of apache to find the configuration file location of apache
#find / -name "httpd.conf"
4. Backup 1 copy of the found source configuration file to prevent failure to recover after errors
#cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
5. Start Apache service
#systemctl start httpd.service
6. Boot up Apache service automatically
#systemctl enable httpd.service Boot from the rev. httpd
#systemctl disable httpd.service Boot not started httpd
Check the status of httpd
#systemctl status httpd.service
2. Problems in the installation process
Apache, Job for httpd, service because the control exited error code. Es559en httpd service and journalctl xe details
Execute command, view error prompt
#systemctl status httpd.service
[root@cloud1 bin]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 5 2018-11-26 11:13:09 CST; 6min ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 9915 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 9913 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 9913 (code=exited, status=1/FAILURE)
11 month 26 11:13:09 cloud1.localdomain httpd[9913]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
11 month 26 11:13:09 cloud1.localdomain httpd[9913]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
11 month 26 11:13:09 cloud1.localdomain httpd[9913]: no listening sockets available, shutting down
11 month 26 11:13:09 cloud1.localdomain httpd[9913]: AH00015: Unable to open logs
11 month 26 11:13:09 cloud1.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
11 month 26 11:13:09 cloud1.localdomain kill[9915]: kill: cannot find process ""
11 month 26 11:13:09 cloud1.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
11 month 26 11:13:09 cloud1.localdomain systemd[1]: Failed to start The Apache HTTP Server.
11 month 26 11:13:09 cloud1.localdomain systemd[1]: Unit httpd.service entered failed state.
11 month 26 11:13:09 cloud1.localdomain systemd[1]: httpd.service failed.
The problem is that port 80 is occupied
Solutions:
View port 80 usage
(1).
netstat -lnp|grep 80
tcp 0 0 192.168.180.68:61027 0.0.0.0:* LISTEN 6289/oproxyd
tcp 0 0 :::80 :::* LISTEN 846/httpd
tcp 0 0 ::ffff:192.168.180.68:7001 :::* LISTEN 32015/java
Kill the process occupying port 80
(2).
kill -9 846
. If the first two methods do not work, then restart the httpd service
2. The startup of Apache failed, httpd: httpd reliably the s s fully qualified name using for ServerName: Could reliably the s fully name using localhost ServerName
. Enter the configuration file of apache
vi /etc/httpd/conf/httpd.conf
./ServerName search ServerName
#yum -y install httpd
0
Get rid of the # in front of it
:wq
Save and exit
. Restart the service
#yum -y install httpd
1
Hopefully this article has helped you with your CentOS server configuration.