1. 程式人生 > >ubuntu系統下關於apache2重啟問題

ubuntu系統下關於apache2重啟問題

現象

伺服器掉電,重啟伺服器虛擬系統後,客戶端開SVN連結,提示伺服器無法連結,此時,伺服器的ip,虛擬系統ip都可以ping通。後來發現可能是重啟伺服器過程中,操作不當,恢復了某些配置,導致如下問題:

1、apache未啟動 。於是執行service apache2 restart 命令時,出現以下報錯:

apache2: Syntax error on line 207 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/httpd.conf: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.
   ...fail!


2、domain name恢復成以前的修改。執行ervice apache2 restart 命令時,出現以下報錯,且在apache重啟成功後,從客戶端依然無法連線到伺服器URL,原因是domain name錯誤,導致URL連線指向錯誤:   

* Restarting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 192.168
.217.6 for ServerName

 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.217.6 for ServerName

解決方法:

問題1:在報錯目錄下,重新建立httpd.conf檔案(vim httpd.conf)即可;執行service apache2 restart 時重啟可成功

問題2:sudo echo ServerName 192.168.218.6 >> /etc/apache2/httpd.conf      /*192.168.218.6為新的domain name*/

 再次重啟apache,不報任何錯誤,重啟成功!