How do you start and enable Apache?
To start and enable Apache on a Linux server, run the following commands in your terminal:
1. The Modern, One-Line Method (Recommended)
You can combine both actions into a single command using the --now flag:
sudo systemctl enable --now httpd
sudo systemctl start httpd
sudo systemctl enable httpd
1. The Modern, One-Line Method (Recommended)
You can combine both actions into a single command using the --now flag:
sudo systemctl enable --now httpd
2. The Traditional, Two-Command Method
If you prefer to run them separately, execute these commands in order:
• Step 1: Start Apache right now
If you prefer to run them separately, execute these commands in order:
• Step 1: Start Apache right now
sudo systemctl start httpd
Step 2: Enable Apache to launch automatically on every system boot
sudo systemctl enable httpd
To check if Apache is running successfully, run:
sudo systemctl status httpd
sudo systemctl status httpd