How do you restart Apache?


ow do I restart an Apache 2 Web Server under a Debian / Ubuntu Linux or UNIX-like operating systems?

Apache is primarily used to serve both static content and dynamic Web pages on the World Wide Web. Many web applications are designed expecting the environment and features that Apache provides.Apache can be started or restarted using any one of the following methods.

First, login to your web-server using ssh client, if server is not in your local data center:
Once logged in type the following commands as per your Linux or Unix variant.

Debian/Ubuntu Linux Specific Commands

You can either use service or /etc/init.d/ command as follows

Restart Apache 2 web server, enter:

# /etc/init.d/apache2 restart
$ sudo /etc/init.d/apache2 restart
$ sudo service apache2 stop

To stop Apache 2 web server, enter:

# /etc/init.d/apache2 stop
$ sudo...

0 0

A. -

Why is XAMPP looking in Apache/mysql/bin/mysql.exe?

I'll hazard a guess that Apache was installed previously in standalone mode.

B. -

"pid file C:/xampp/apache/logs/ overwritten".

This message occurs when Apache is restarted. The PID file is the process ID file that is used by Windows Task Manager (and the OS) to track running processes. The restart creates a new instance of the process. There are actually 2 instances of the httpd.exe process started by Apache for Win32. ... n-windows/

Here's how to find out what is going on with Apache.

Use the Service Control Management console. Yo can start it from Control Panel, My Computer > Manage or the XAMPP Control Panel (SCM button)

Look for Apache2.2 in the list - Right Click and select Properties - check the 'path to executable' and if it is not "c:\xammp\apache\bin\httpd.exe" -k runservice -- you have the...

0 0
0 0

Kristylee g wrote:

what about on a Linux server? also trying to do this and redmine is not recognizing that I made any changes.

For bitnami-redmine-1.0.1-0-ubuntu-10.04:

root@linux:~# /etc/init.d/bitnami restart /opt/bitnami/subversion/scripts/ : subversion stopped Syntax OK /opt/bitnami/apache2/scripts/ : httpd stopped stopping port 3001 stopping port 3002 100903 08:34:40 mysqld_safe mysqld from pid file /opt/bitnami/mysql/data/ ended /opt/bitnami/mysql/scripts/ : mysql stopped 100903 08:34:45 mysqld_safe Logging to '/opt/bitnami/mysql/data/mysqld.log'. 100903 08:34:46 mysqld_safe Starting mysqld.bin daemon with databases from /opt/bitnami/mysql/data /opt/bitnami/mysql/scripts/ : mysql started at port 3306 starting port 3001 starting port 3002 Syntax OK /opt/bitnami/apache2/scripts/ : httpd started at port 80 /opt/bitnami/subversion/scripts/ : subversion started at port 3690

If that doesnt work, you've...

0 0

On Windows, Apache is normally run as a service. For details, see Running Apache as a Service.

On Unix, the httpd program is run as a daemon that executes continuously in the background to handle requests. This document describes how to invoke httpd.

If the Listen specified in the configuration file is default of 80 (or any other port below 1024), then it is necessary to have root privileges in order to start apache, so that it can bind to this privileged port. Once the server has started and performed a few preliminary activities such as opening its log files, it will launch several child processes which do the work of listening for and answering requests from clients. The main httpd process continues to run as the root user, but the child processes run as a less privileged user. This is controlled by the selected Multi-Processing Module.

The recommended method of invoking the httpd executable is to use the apachectl control...

0 0

Bitnami images come with SSL support already pre-configured and with a dummy certificate in place. Although this dummy certificate is fine for testing and development purposes, you will usually want to use a valid SSL certificate for production use. You can either generate this on your own (explained here) or you can purchase one from a commercial certificate authority.

Once you obtain the certificate and certificate key files, you will need to update your server to use them. To understand the process, first choose your environment from the options below.

Bitnami Cloud Hosting

Choose which of the two scenarios more closely matches your intended use.

SCENARIO 1. You have configured your application in the Bitnami Cloud Hosting dashboard such that it is hosted at the root of your custom domain name eg. a Wordpress blog hosted at

SCENARIO 2. You have configured your application in the Bitnami Cloud Hosting dashboard such that...

0 0

Script cannot continue while server is down (at least not as a script, it can start another process, change its group and not be killed by Apache on restart, but it won't be able to return result in any case).

Here is a workaround:

Create a script that can give you a process ID of the Apache web server. Call it from the client side and remember it. Call the script that restarts Apache. Do not expect it to give you a result because it can't. It is better to call it using Ajax, hidden frame or whatever else is appropriate so that user doesn't see it. Wait some time and start calling the script that gives you a process ID again. Reaching a timeout while trying to call that script will mean that something went wrong and Apache failed to start after shutdown. Reaching a timeout trying to get different process ID means server wasn't restarted at all. Otherwise, process ID will be different (don't expect it to be greater or lower, however, it is very OS specific). By timeout I...
0 0

As Marc B stated, you'll need root privs to have the ability to restart Apache. The easiest method to handle this, IMHO, would be to provide the user that Apache runs under use of restart Apache via the sudo command.

You will want to edit your /etc/sudoers file and add lines like the following:

Cmnd_Alias RESTART_APACHE = /sbin/service apache2 restart www-data ALL=NOPASSWD: RESTART_APACHE

You might need nobody rather than www-data, it is dependent around the user which Apache runs under. On Debian, Apache typically runs under user www-data, whereas under Red-colored Hat, frequently Apache runs under user nobody. Also, the /sbin/service apache2 restart might need to be /sbin/service apache restart or possibly /sbin/service httpd restart. All is dependent in your system's configuration.

Once that's done, in PHP you should use the code:

exec('/sbin/service apache2 restart');

(Clearly altering when the command to restart Apache differs in your...

0 0

Often times, as server administrator, have to telnet or SSH to their server to restart the Apache Http services. The Apache http services are usually located at the following location,

1) init.d start script folder.

issue “./apache restart” to restart it

debian:/etc/init.d# ./apache restart Forcing reload of web server (apache)... waiting . debian:/etc/init.d#

2) usr/local/apache/bin

issue “./apachectl restart” to restart it

debian:/usr/local/apache/bin# ./apachectl restart Forcing reload of web server (apache)... waiting .

P.S Your may need sudo privileged to restart the Apache services, and the Apache service name (apache2, apachectl) may vary in server

Where is my Apache installation folder?

How about you do not remember where is your Apache installation folder? Just issue the following command to find it out.

find . -name...
0 0

A restart is not required for changes to .htaccess. Something else is wrong.

Make sure your .htaccess includes the statement

RewriteEngine on

which is required even if it's also present in httpd.conf. Also check that .htaccess is readable by the httpd process.
Check the error_log - it will tell you of any errors in .htaccess if it's being used. Putting an intentional syntax error in .htaccess is a good check to make sure the file is being used -- you should get a 500 error on any page in the same directory.

Lastly, you can enable a rewrite log using commands like the following in your httpd.conf:

RewriteLog "logs/rewritelog"

RewriteLogLevel 7

The log file thus generated will give you the gory detail of which rewrite rules matched and how they were...

0 0

Posted December 22nd, 2004 in Apache (Updated November 16th, 2010)

If you have made changes to the Apache configuration file httpd.conf or one of the other included configuration files such as the vhosts.d files, you need to reload the Apache service for the changes to take effect. From the command line you do this with the apachectl command. The exact location of this command varies on the Unix or Linux variant you are using (eg Fedora, OSX, FreeBSD, Slackware, Mandrake, SUSE) and the compile time settings, but typically it is accesible at /usr/sbin/apachectl

Gracefully restarting Apache

An example of restarting Apache gracefully is shown below:

/usr/sbin/apachectl graceful

Note that you will either need to be running as root or use the "sudo" command in order to run this command.

If Apache is not already running it will be started. If it is already running then it will reload with the new changes but will not abort active connections,...

0 0

ow do I start, restart, or stop Apache 2.x web server on Ubuntu Linux operating systems using command line options?

You can use any one of the following method to restart / start / stop your Apache (httpd) sever on Ubuntu:

systemctl command – Only works on systemd based Ubuntu like version 16.04 LTS and above. /etc/init.d/apache2 – A sys v init style script to start / stop / restart the Apache2 service under Debian or Ubuntu Linux. service command – This command work in most Linux distributions including Debian and Ubuntu. upstart command – Only works on certain version of Ubuntu. apache2ctl command – This method should work on all Linux and Unix like operating systems.

Method #1: systemctl command examples

To start Apache 2 on Ubuntu Linux LTS 16.04 LTS or the latest systemd based Ubuntu Linux, type:
$ sudo systemctl start apache2.service
To stop Apache 2 on Ubuntu Linux LTS 16.04 LTS or the latest systemd based Ubuntu Linux,...

0 0

Please note

This document refers to a legacy release (2.2) of Apache httpd. The active release (2.4) is documented here. If you have not already upgraded, please follow this link for more information.

You may follow this link to go to the current version of this document.

In order to stop or restart Apache, you must send a signal to the running httpd processes. There are two ways to send the signals. First, you can use the unix kill command to directly send signals to the processes. You will notice many httpd executables running on your system, but you should not send signals to any of them except the parent, whose pid is in the PidFile. That is to say you shouldn't ever need to send signals to any process except the parent. There are four signals that you can send the parent: TERM, USR1, HUP, and WINCH, which will be described in a moment.

To send a signal to the parent you should issue a command such as:


0 0

Here's a quick summary of how to





Business Level accounting: Contact Live Technical Support to request reboot

VPS (without Root access): Able to restart services in WHM. They can also restart services by using AMP.

VPS (with Root access): Able to restart all services in WHM, AMP, or through Command line. A restart button for the server is available in WHM, but do not use it.

Dedicated(without Root access) can restart services in WHM. Contact Live Technical Support to request reboot

Dedicated Server (with Root access): Can restart services or the server in WHM or with the command line.

For different reasons, VPS customers may want to restart their server services. This is similar to rebooting the server; except, rebooting the actual hardware is "rebooting" the server. Restarting the services restarts the Apache, MySQL, or Email services that run on the server. The services for VPS servers can be...

0 0

Restart apache is a bad idea, maybe you can just reload? Or check apache status and restart if apache is down.

#!/usr/bin/env python import urllib2 import commands from subprocess import Popen ip = '' try: link = urllib2.urlopen('http://%s' % ip).code print link except urllib2.HTTPError as e: print e.code except urllib2.URLError: Popen(['invoke-rc.d','apache2','restart'])

and cron job will be

*/5 * * * *

And first of all, when you want to restart apache in scripts, you must check configuration file for errors.

#!/usr/bin/env python import re from subprocess import check_output, call def is_config_ok(): if re.findall('OK',check_output('apache2ctl configtest', shell=True)): return 1 else: return 0 if __name__ == "__main__": if is_config_ok(): call('invoke-rc.d apache2 restart', shell=True) else: print "error in...
0 0

How do I check on the size of the queue? I know it's not JMS standard, but most JMS implementations have a way to do this.

You can view the queue depth using the MBeans in ActiveMQ 5.x. Use any JMX management console to see the statistics. See How can I monitor ActiveMQ.

You can also browse the contents of a queue using the JMS QueueBrowser.

Or you can access statistics programmatically

Through the MBeans, you can monitor individual destinations including message statistics related to the destination. For example, you'll see the following attributes on a destination (Queue or Topic):

Enqueue Count - the total number of messages sent to the queue since the last restart Dequeue Count - the total number of messages removed from the queue (ack'd by consumer) since last restart Inflight Count - the number of messages sent to a consumer session and have not received an ack Dispatch Count - the total number of messages sent to consumer sessions (Dequeue +...
0 0

Short answer:

Using visudo, add the following to your sudoers file, replacing username with the proper username:

username ALL = /etc/init.d/apache2

If you want to not have to type in a password before you do this, use the following:

username ALL = NOPASSWD: /etc/init.d/apache2

After this, the 'username' user can execute sudo /etc/init.d/apache2 start (or stop, restart,etc)

Long answer: You'll likely want to setup a separate user for this if you haven't already, and then configure the /etc/sudoers file to allow a user or group to execute the command you want.

For example, to allow the user 'ben' to execute all commands as root prompting for a password, you would do the following:

ben ALL= ALL

To allow 'ben' to execute only one command (like say, rm), you would do the following:

ben ALL= /bin/rm

If you are running a script as a user and don't want to prompt for a password, you'll want to use the 'NOPASSWD' option like so:

0 0