Apache installation and start / stop / auto start settings --CentOS7

This is the procedure for installing Apache on CentOS7 and setting start / stop / automatic start.

Apache installation

Install Apache using the yum command.

#Install Apache
sudo yum -y install httpd

Apache version check

Let's check the version of Apache.

httpd -version

The version of Apache was 2.4.6.

Server version: Apache / 2.4.6 (CentOS)
Server built: Aug 8 2019 11:41:18

Apache auto-start settings

Make sure Apache starts automatically when you start CentOS7. Use the systemctl command "enable" to set Apache to start automatically.

#Apache autostart settings
sudo systemctl enable httpd.service

Start Apache

Start Apache. To start Apache, use the systemctl command "start".

#Start Apache
sudo systemctl start httpd.service

Stop Apache

Use the systemctl command "stop" to stop Apache.

# Stop Apache
sudo systemctl stop httpd.service

Restart Apache

Use the systemctl command "restart" to restart Apache.

#Restart Aapche
sudo systemctl restart httpd.service

How to enable HTTPS connection?

The HTTPS connection is an SSL connection, so mod_ssl is required. Please refer to the following articles.

Associated Information