Common Commands
- Ubuntu
Choose your web server from the tabs mentioned below:
- Nginx
- Apache2
Nginx Common Commands
Nginx Status
To check the status of your web server, use the command:
sudo systemctl status nginx
Start Nginx
To start the web server when it is stopped, use the command:
sudo systemctl start nginx
Stop Nginx
To stop your web server, use the command:
sudo systemctl stop nginx
Restart Nginx
To stop and then start the service again, use the command:
sudo systemctl restart nginx
Reload Nginx
If you are only making configuration changes, Nginx can often reload without dropping connections. To do this, use the command:
sudo systemctl reload nginx
Disable Nginx
By default, Nginx will be configured to start automatically when the server boots. If this is not what you want, you can disable this behavior using the command:
sudo systemctl disable nginx
Enable Nginx
To re-enable the service to start up at boot, you can use the command:
sudo systemctl enable nginx
Apache2 Common Commands
Apache2 Status
To check the status of your web server, use the command:
sudo systemctl status apache2
Start Apache2
To start the web server when it is stopped, use the command:
sudo systemctl start apache2
Stop Apache2
To stop your web server, use the command:
sudo systemctl stop apache2
Restart Apache2
To stop and then start the service again, use the command:
sudo systemctl restart apache2
Reload Apache2
If you are only making configuration changes, Apache2 can often reload without dropping connections. To do this, use the command:
sudo systemctl reload apache2
Disable Apache2
By default, Apache2 will be configured to start automatically when the server boots. If this is not what you want, you can disable this behavior by typing:
sudo systemctl disable apache2
Enable Apache2
To re-enable the service to start up at boot, you can type:
sudo systemctl enable apache2