CentOS下apache綁定網域名稱

來源:互聯網
上載者:User

標籤:http   os   io   strong   檔案   for   ar   cti   

本文主要介紹在CentOS下apache綁定網域名稱以及apache綁定多個網域名稱,首先要找到apache的設定檔httpd.conf的位置。CentOS作業系統一般在 /etc/httpd/conf 下,有的Linux作業系統版本是在 /etc/Apache2/conf  或 /usr/local/etc/apache  檔案夾裡面,剩下需要做的是修改設定檔httpd.conf,一般設定檔最下面有如下綁定網域名稱說明:

 
  1. # VirtualHost example: 
  2. # Almost any Apache directive may go into a VirtualHost container. 
  3. # The first VirtualHost section is used for requests without a known 
  4. # server name. 
  5. #<VirtualHost *:80>
  6. #    ServerAdmin [email protected] 
  7. #    DocumentRoot /www/docs/dummy-host.example.com 
  8. #    ServerName dummy-host.example.com 
  9. #    ErrorLog logs/dummy-host.example.com-error_log 
  10. #    CustomLog logs/dummy-host.example.com-access_log common 
  11. #</VirtualHost>

    大家可以依葫蘆畫瓢,也可以結合相關文法加入自己的配置說明,下面是我無憂程式的設定檔:1、* 星號修改成自己網站的IP地址 2、ServerAdmin管理員郵箱(可有可無) 3、DocumentRoot網站檔案在伺服器的目錄路徑 4、ServerName綁定相應網域名稱 5、ServerAlias泛解析綁定子網域名稱 6、ErrorLog和CustomLog指定記錄檔存放路徑。

 
  1. <VirtualHost 175.102.8.117:80>
  2.     addDefaultCharset gbk 
  3.     DocumentRoot /chengxu
  4.     ServerName 66php.com 
  5.     ServerAlias *.66php.com 
  6.     ErrorLog /sym/logs/66php.com-error_log 
  7.     CustomLog /sym/logs/66php.com-access_log common 
  8. </VirtualHost>

    如果一個伺服器綁定多個網域名稱不是在ServerName添加多個網域名稱,ServerName 後面只能加一個網域名稱,要重複綁定則需要添加多加多個VirtualHost模組。

相關文章

聯繫我們

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