httpd

Posted on

Installing Apache

As a non root sudo user update httpd package

sudo yum update httpd

After update install Apache package

sudo yum install httpd

Add http and https services to firewall (port 80 and 443)

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https

reload firewall

sudo firewall-cmd --reload

Verify services started and enable on server boot

sudo systemctl start httpd
sudo systemctl status httpd
sudo systemctl enable httpd.service

check ip address of raspberry pi

hostname -I

in web browser navigate to http://<IP address>
the test website should appear

Managing Apache

To stop Apache web server

sudo systemctl stop httpd

To start the web server when it is stopped

sudo systemctl start httpd

To stop and then start the service again

sudo systemctl restart httpd

Apache can be reloaded without dropping connections

sudo systemctl reload httpd

Apache is configured to start automatically when the server boots.
To disable this

sudo systemctl disable httpd

To re-enable the service to start up at boot

sudo systemctl enable httpd

Apache will start automatically when server boots.