因為本機有Nginx,所以沒有安裝Apache2的需要。
不過今天為了學習如何使用icinga,還是學一下apache2吧,以後熟悉了icinga,再用Nginx將Apache2替換。
安裝很簡單:
apt-get install apache2
然後自動啟動失敗,因為我的Nginx佔著80連接埠和443連接埠呢。
通過whereis apache2尋找,發現/etc/apache2目錄
好,開啟該目錄下的ports.conf檔案,
把所有的80連接埠改成81,443改成444.
然後看檔案注釋上說要/etc/apache2/sites-enabled/000-default檔案,開啟檔案後
把
<VirtualHost *:80>
修改成81,然後看到根目錄在/var/www下面
到/var/www/目錄看到有index.html檔案
<html><body><h1>It works!</h1><p>This is the default web page for this server.</p><p>The web server software is running but no content has been added, yet.</p></body></html>
現在重新啟動apache2
service apache2 restart
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName [ OK ]
可以開啟/etc/apache2/apache2.conf檔案
添加上一句:
ServerName localhost
再次重啟後錯誤消失。
開啟網頁,輸入localhost:81地址,看到Index.html頁面顯示出來了。