How To Restart an Apache Web Server
What Is An Apache Web-Server?
Apache HTTP server is open-source software that is available for download free of charge. It is also known as Apache or referenced as httpd when referring to the daemon service. It is the most widely-known web server in use on the internet, serving approximately 29.12% of the million busiest websites (see April 2020 Web Server Survey.)
HostGator web servers use this Linux-based program to view web pages. It is efficient in processing requests for static content and contains features to utilize Secure Socket Layers (SSLs), Virtual Hosts (Vhost), and Common Gateway Interface (CGI) applications. This software also supports PHP, Python, and Perl.
While HTTPD is software, it also runs in the background to process any server request. HTTPD, with reference to Apache, executes the process by creating threads or child processes to handle incoming requests.
Apache Tomcat
Or “Apache Tomcat” is an open-source implementation of the Java Servlet and JavaServer Pages technologies, including Java Expression Language and WebSocket. "Pure Java" or Java-ran code that serves as an environment for this tool, creating an "Easy" key factor impression to all who selected this. This is also called an "application server," which means it delivers dynamic content using Java technologies.
More information about this can be read in the Tomcat Java article.
Restarting Apache
How to Restart a Service Manually in WHM
Note: You should NEVER restart a service on a HostGator Shared or Reseller Server.
- Log into WHM as root.
- Scroll the left navigation bar down to the Restart Services section.
- Click on the name of the service you wish to restart (Example: HTTP Server (Apache)).
- The WHM will ask if you are sure you wish to restart the service; please click Yes.
- The WHM will show a successful confirmation prompt.
- Ensure the service is now active by using the status command in EIGshell, or by viewing the status in WHM under Service Status.
Restart services from the command line
/usr/local/cpanel/scripts/restartsrv_cpipv6
after you restart the network service. This will restart the IPv6 configuration once you’re done running the command for the service network restart.Using the restartsrv script
In case the restart will not happen in WHM, use the command:
/usr/local/cpanel/scripts/restartsrv_*
This will try to restart the service from the command line.
Take note in running this command: Place the correct value for the service in the *.
Direct Service Restart
If this script, /usr/local/cpanel/scripts/restartsrv_*
does not restart the service, attempt restarting the service directly.
The following command should be used for servers that run CentOS, CloudLinux™, Red Hat® Enterprise Linux (RHEL) 6, or Amazon Linux. The path to the service should be: /etc/rc.d/init.d/service
/etc/rc.d/init.d/service restart
The command below is for servers that run CentOS 7, CloudLinux 7, or RHEL 7. The service name is the service that you want to restart:
systemctl restart service-name.service
If the attempt to restart fails, service error logs. To diagnose the issue, check out the service error log. Since the errors were logged differently by the service logs, you have to find the location of the error log. You can check the service’s documentation to find the error log’s location.
The common locations for some service’s error logs are on the list below:
- Apache web server —
/usr/local/apache/logs/error_log
- BIND nameserver, ProFTP FTP server, Pure-FTP FTP server —
/var/log/messages
- Exim mail transfer agent (MTA) —
/var/log/exim_mainlog
,/var/log/exim_rejectlog
,/var/log/exim_paniclog
Note: If/var/log/exim_paniclog
file isn’t empty, it means that there are serious problems with Exim and some distributions may not function well. - Dovecot® mail server —
/var/log/maillog
- MySQL database server —
/var/lib/mysql/hostname.err
Note: Replace hostname with your server’s hostname. - OpenSSH secure shell service — /var/log/messages, /var/log/secure, /var/log/auth
Service Commands
The instructions below show the syntax to use to see the command status, stop, start, and restart of service.
The general syntax or command: service SCRIPT-Name COMMAND
This COMMAND is for a start, stop, status, and restart.
The stop command: service SCRIPT-Name stop
To stop the sshd service, input:service sshd stop
The start command: service SCRIPT-Name start
To start the sshd service, input: service sshd start
The status command: service SCRIPT-Name status
To get the current status of the sshd service, enter: service sshd status
The restart command: service SCRIPT-Name restart
To restart the sshd service, enter: service sshd restart
For further details on stopping and restarting Apache and its details, refer to this reading: Apache Stop and Restart
This article, Processes Limit, can also help you out in restarting Apache for process limits in VPS and Dedicated Servers.
Forcing https on Apache, redirecting one URL to another URL, rewriting requested URLs, limiting access to your site, and much more examples on mod_rewrite can be read here: Apache mod_rewrite and Examples.
To read more information on Apache, read the article below: