How To Restart Apache

Table of contents:

How To Restart Apache
How To Restart Apache

Video: How To Restart Apache

Video: How To Restart Apache
Video: How to Start Apache from Command Line 2024, November
Anonim

The most popular and multifunctional HTTP server today is Apache. It is very stable and able to function continuously for many years. However, Apache must be restarted to update configuration parameters, for example, when the list of virtual hosts changes.

How to restart apache
How to restart apache

It is necessary

  • - root rights on the target machine;
  • - possibly an SSH client program.

Instructions

Step 1

Log in to your local machine or connect to a remote server running Apache and also authorize. If you have physical access to the machine on which the server is running, requiring a reboot, and a monitor and keyboard are connected to it, the authorization process will not be a problem.

If the target machine has only remote SSH access, use client programs to connect. On Windows, you can use the free PuTTY graphical client available for download from putty.nl. On Linux-like systems, switch to a text console or start a terminal emulator, and then run a command like this:

ssh username @ server_address

After connecting, enter the password.

How to restart apache
How to restart apache

Step 2

Start a superuser session. Run the su command. Enter the root password.

How to restart apache
How to restart apache

Step 3

Determine which Apache server is running on the target machine. Run the command:

service httpd status

A message like httpd is running will indicate that Apache version 1.x is running. Service: httpd: Unrecognized service indicates that the service is not installed. Httpd is stopped says that the server is installed but not running.

Similarly, check if Apache 2.x is running. Run the command:

service httpd2 status

Upon verification, the presence or absence of the httpd and httpd2 services will be revealed. At the same time, they (including at the same time) can be both started and stopped. If the target machine is running Apache, go to the next step.

How to restart apache
How to restart apache

Step 4

Restart Apache. To restart the server by stopping it and then starting it, run a command like this:

service service_name restart

Specify httpd or httpd2 for the service name, depending on the results obtained in the previous step. To perform a soft restart with a configuration update, use graceful instead of the restart parameter. For example:

service httpd2 graceful

This method is preferred.

How to restart apache
How to restart apache

Step 5

Finish your work. Close the superuser session by running the exit command. Disconnect from the server using the exit or logout commands.

Recommended: