How To Start, Stop, and Restart Apache and MySQL on Arch Linux

Most system admins keep servers pretty slim with no Graphical User Interface (GUI). We will stick with the basics and use a few commands to start, stop, and restart Apache as well as some related services on Arch Linux.

Arch uses a BSD-Sytle initialization program for starting and stopping daemons. So if you want restart a process the script is usually stored in /etc/rc.d/ directory.

Here you can see on an almost bare bones system some of the scripts. (Example: httpd, networking, sshd..etc)

 

 

Arch Linux - List of some basic scripts in /etc/rc.d

 

 

You call the script as well as the action.

Note: You will need to have root privileges or being login with a user that has sudo access.

 

To Restart Apache in Arch Linux issue the following command:

/etc/rc.d/httpd restart

 

 

Arch Linux - How to Restart Apache web server - /etc/rc.d/httpd restart

 

 

You could also use

/etc/rc.d/httpd reload

 

 

Arch Linux - Reload Apache Web Server  /etc/rc.d/httpd reload

 

 

To Stop Apache

/etc/rc.d/apache stop

 

 

Arch Linux To Stop Apache Web Server /etc/rc.d/httpd stop

 

 

To Start Apache

/etc/rc.d/httpd start

 

 

Arch Linux - Start Apache Web Server /etc/rc.d/httpd start

 

 

Today a lot of sites use a MySQL database for the backend. There are time you may need to also start, stop, and restart MySQL. Once again this is a very simple task in Arch using a single command.

To Restart MySQL

/etc/rc.d/mysqld restart

 

 

Arch Linux Restart MySQL database /etc/rc.d/mysqld restart

 

 

To Stop MySQL

/etc/rc.d/mysqld stop

 

 

Arch Linux Stop MySQL DB Server /etc/rc.d/mysqld stop

 

 

To Start MySQL

/etc/rc.d/mysqld start

 

 

Arch Linux Start MySQL DB Service /etc/rc.d/mysqld start

 

 

If you would like to have the services auto start when you start your server. Edit /etc/rc.conf

(Use a text editor your choice.  Nano is a really easy one)

 

 

Arch Linux - Edit /etc/rc.conf to add mysql and apache to startup

 

 

Scroll down to the bottom

 

Arch Linux rc.conf scroll down

 

 

Add mysqld and httpd in the daemon section.

 

 

Add mysqld and httpd in the DAEMONS secotion

 

 

Save your changes and reboot your system to test it out.

Hope you found this helpful!