Restarting web services (Apache, Nginx, MySQL)

To restart common web services like Apache, Nginx, and MySQL, you typically use systemctl (on most modern Linux systems):

Apache (httpd on CentOS, apache2 on Ubuntu)

# Ubuntu/Debian

sudo systemctl restart apache2

# CentOS/RHEL

sudo systemctl restart httpd

Nginx

sudo systemctl restart nginx

MySQL (or MariaDB)

# MySQL

sudo systemctl restart mysql          # Ubuntu/Debian

sudo systemctl restart mysqld         # CentOS/RHEL

# MariaDB

sudo systemctl restart mariadb

Check status (optional but recommended)

sudo systemctl status apache2             # Or httpd/nginx/mysql/mysqld/mariadb

Leave a Reply

Your email address will not be published. Required fields are marked *