Jump to content
xisto Community
nightfox1405241487

Restarting Apache Server

Recommended Posts

I've worked with Apache long enough that I know (or at least I thought I knew) how to restart it. The problem: my terminal is filled with "command not found" and other errors and the such.httpd restart, right? NOPE! Command not found!apachectl restart, NOPE! Command not found!I'm out of ideas! I can't just keep physically re-booting the machine when I need JUST apache to restart! Thanks for any help, my system is Debain 3.1 r1.[N]F

Share this post


Link to post
Share on other sites

/sbin/service httpd reload


Houdini is close but the proper commands you can do is

/sbin/service httpd start
/sbin/service httpd stop
/sbin/service httpd restart

Which restart is is the one you've after, can only be performed by root or a super user.

I usually do:

su -c "/sbin/service httpd restart"

Which is similar to sudo but I feel is much better to use than sudo, it may not work with some older distributions.


Cheers,


MC

Share this post


Link to post
Share on other sites

/sbin/service httpd reload

 


i think that depends on the version, right?

for me it works when i type:

sudo /etc/apache/apachectl restart
i think this is because my apache version is 1.3, right?

Share this post


Link to post
Share on other sites

i think that depends on the version, right?

Really depends on version.On my system I have to do
cd $ORACLE_HOME/Apache/Apache/bin
./apachectl stop
./apachectl start

sounds rather different, isn't it ?

Share this post


Link to post
Share on other sites

Really depends on version.

On my system I have to do

cd $ORACLE_HOME/Apache/Apache/bin

./apachectl stop

./apachectl start

sounds rather different, isn't it ?

 

Nope, it's the same mate, as it's the same command, me too i can do it directly by ./apachectl restart or stop then start, i meant the difference is wither it's httpd, apache 1.34 or apache2, that's what i meant :o

Share this post


Link to post
Share on other sites

I don't get this... I've tried every command you guys have given and none of them work!service apache restart gives me: "bash: service: command not found"/etc/init.d/httpd restart gives me: "bash: /etc/init.d/httpd: No such file or directory"/etc/apache/apachectl restart gives me: "/etc/apache/apachectl: No such file or directory"/sbin/service httpd reload gives me: "/sbin/service: No such file or directory"hmm... I don't know... the file structure seems to be normal.var/www contains all of the default documents, etc/apache2 seems to have everything normal. Is there a way I could go about uninstalling Apache and re-installing it?[N]F

Share this post


Link to post
Share on other sites

OK then, give us the important information that we need.What distribution are you running? What version of Apache do you have installed?Going by what you've said you say you've got Apache2, in /etc/Apache2, that sounds like Debian or a variant of it.So the command that you will need to use is/etc/init.d/apache2 restartorapache2ctl restartFor the apache2ctl command, If it returns command not found, do:which apache2ctlAnd it will show paths of where this command could exist, then you would do /path/to/apache2ctl restartCheers,MC

Share this post


Link to post
Share on other sites

I've worked with Apache long enough that I know (or at least I thought I knew) how to restart it. The problem: my terminal is filled with "command not found" and other errors and the such.
httpd restart, right? NOPE! Command not found!
apachectl restart, NOPE! Command not found!

I'm out of ideas! I can't just keep physically re-booting the machine when I need JUST apache to restart! Thanks for any help, my system is Debain 3.1 r1.

[N]F


Hi nightfox,

try this command as root:
httpd -k restart

bakr_2k5

<edit>
Uh yes sorry about that, kinda old thread but anyway didn't know if the problem was gone :)
</edit>
Edited by bakr_2k5 (see edit history)

Share this post


Link to post
Share on other sites

Still useful. However, this syntax is not worth everywhere. On my system,

CONSOLE
SYNOPSIS httpd [ -X ] [ -L libexecdir ] [ -d serverroot ] [ -f config ] [ -C directive ] [ -c directive ] [ -D paramètre ] httpd [ -h ] [ -l ] [ -v ] [ -V ] [ -S ] [ -? ]
so, the option -k seems not to exist on my Redhat, nor the -restart option.

Share this post


Link to post
Share on other sites

I use Fedora Core 5 and it states in the man pages:

NAME httpd - Apache Hypertext Transfer Protocol Server

SYNOPSIS
httpd [ -d serverroot ] [ -f config ] [ -C directive ] [ -c directive ]
[ -D parameter ] [ -e level ] [ -E file ] [ -k start|restart|grace-
ful|stop|graceful-stop ] [ -R directory ] [ -h ] [ -l ] [ -L ] [ -S ] [
-t ] [ -v ] [ -V ] [ -X ] [ -M ]


Strange .. Maybe some different versions?

Share this post


Link to post
Share on other sites

Probably, yes. I'm using "Kernel 2.6.9-22.EL on an i686."


I'm on a 2.6.17-1.2187_FC5 64bit (x86_64)
Perhaps RedHat packages are a bit more expert orientated?
Since RedHat is really a server distro...
Well who knows.

These commands work too on my system
CONSOLE

apachectl restart
apachectl -k restart
/etc/rc.d/init.d/httpd restart


bakr_2k5
Edited by bakr_2k5 (see edit history)

Share this post


Link to post
Share on other sites
Replying to mastercomputersReplying to nightfoxHow was apache installed ??If its residing under one of the system path then simple "service httpd restart" should have worked but if its source compiled with a different --prefix folder which you are not aware of then use "ps -wwaux | grep httpd" to get process listing , this will also give you the path under which you have the binaries, in my case I got thisDaemon 30146 0.0 0.0 171808 5548 ? S 22:12 0:00 /usr/local/apache/bin/httpd -k startDaemon 30321 0.0 0.0 171808 5552 ? S 22:21 0:00 /usr/local/apache/bin/httpd -k startDaemon 31419 0.0 0.0 171808 5544 ? S 23:18 0:00 /usr/local/apache/bin/httpd -k startDaemon 31421 0.0 0.0 171808 5552 ? S 23:18 0:00 /usr/local/apache/bin/httpd -k startMy apache resides under "/usr/local/apache" so I can use/usr/local/apache/bin/apachectl restart/graceful/reload, I hope this info may be of some use.-reply by Robinson

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.