UBuntu 安裝和修改Apache2連接埠

來源:互聯網
上載者:User

因為本機有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頁面顯示出來了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.