2012-02-26 44 views
0

不知道爲什麼,但是當我運行:須藤的Apache2停止不起作用

[email protected]:/etc/init.d$ sudo apache2 stop 
Usage: apache2 [-D name] [-d directory] [-f file] 
       [-C "directive"] [-c "directive"] 
       [-k start|restart|graceful|graceful-stop|stop] 
       [-v] [-V] [-h] [-l] [-L] [-t] [-S] [-X] 
Options: 
    -D name   : define a name for use in <IfDefine name> directives 
    -d directory  : specify an alternate initial ServerRoot 
    -f file   : specify an alternate ServerConfigFile 
    -C "directive"  : process directive before reading config files 
    -c "directive"  : process directive after reading config files 
    -e level   : show startup errors of level (see LogLevel) 
    -E file   : log startup errors to file 
    -v     : show version number 
    -V     : show compile settings 
    -h     : list available command line options (this page) 
    -l     : list compiled in modules 
    -L     : list available configuration directives 
    -t -D DUMP_VHOSTS : show parsed settings (currently only vhost settings) 
    -S     : a synonym for -t -D DUMP_VHOSTS 
    -t -D DUMP_MODULES : show all loaded modules 
    -M     : a synonym for -t -D DUMP_MODULES 
    -t     : run syntax check for config files 
    -X     : debug mode (only one worker, do not detach) 

它似乎並沒有停止服務器。我仍然試圖ping IP,它返回默認頁面。爲什麼有這個原因?

回答

1

嘗試:

sudo service apache2 stop 

在這裏看到:

老辦法是:

sudo /etc/init.d/apache2 stop 

請注意,當您執行sudo apache2 stop時,您正在從PATH運行apache2,而不是從當前文件夾(通常,.不在PATH中)。試試sudo ./apache2 stop

在這裏看到:

+0

這太棒了。謝謝! – locoboy 2012-02-26 19:29:21

+0

當然,很樂意幫忙! – 2012-02-26 19:42:06

0

你必須鍵入apache2 init腳本的完整路徑。例如:

sudo /etc/init.d/apache2 stop 
+0

服務一部分,如果你檢查我的'pwd'應該是同樣的事情嗎? – locoboy 2012-02-26 19:29:44

0

檢查Ubuntu的@ IP-10-46-206-16:/etc/init.d$ ./apache2停止

這將解決您的問題

0

命令中缺少一件事,我遇到了同樣的問題:

sudo apache2 stop 

應該

sudo service apache2 stop 

希望沒有一個搜索太遠失蹤命令:)