Apache 學習筆記

來源:互聯網
上載者:User

標籤:apache

     系統內容:Ubuntu


     1. 查看 apache2 版本

?  ~  apachectl -vServer version: Apache/2.4.7 (Ubuntu)Server built:   Apr  3 2014 12:20:25


     2.重啟 apache

#重啟 apachesudo /etc/init.d/apache2 restart#開啟 apachesudo /etc/init.d/apache2 start#關閉 apachesudo /etc/init.d/apache2 stop


     3.開啟 htaccess 用於存取控制。開啟 apache 設定檔,我的是 /etc/apache2/apache2.conf,因為我的 web 目錄在 /var/www 下,所以找到設定檔中的對應目錄,並把 AllowOverride 選項改為 All.  AllowOverride 表示允許存在於.htaccess 檔案中的指令類型,None 表示不搜尋該目錄下的.htaccess檔案,All 表示在 .htaccess 檔案中可以使用所有的指令。

<Directory /var/www/>Options Indexes FollowSymLinksAllowOverride AllRequire all granted</Directory>


    4.重啟時出現 AH00558: apache2: Could not reliably determine the server‘s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName‘ directive globally to suppress this message。

     開啟設定檔,加上 ServerName 的定義     

#開啟設定檔sudo vim /etc/apache2/apache2.conf#在其中加上這一句ServerName localhost:80

     5.重啟時出現 (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80

     網上給出了各種方法:

     http://ubuntuforums.org/showthread.php?t=1636667

     http://stackoverflow.com/questions/10160339/starting-apache-fails-could-not-bind-to-address-0-0-0-080

     結果都發現不起作用,因為根本就找不到佔用了 80 連接埠的進程。

     最後發現是因為在 apache2.conf 同一級目錄下的 ports.conf, 裡面已經有 Listen 80 了,然後在 apache2.conf 裡面有

Include ports.conf
     即是包含了 ports.conf 檔案,所以是重複定義了,難怪會出錯。。。。

     解決方案是:這一句不用寫了....或者 Listen 另一個連接埠

     Ps:假如寫了 Listen 23333, Apache 就會為你開啟這個連接埠,不用自己先去開啟。


     6. 出現問題 AH00548: NameVirtualHost has no effect and will be removed in the next release
     從 Apache 2.3.11 開始的版本,這一句已經不需要了,刪之。。。。


      待續。

Apache 學習筆記

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.