標籤: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,一般設定檔最下面有如下綁定網域名稱說明:
- # VirtualHost example:
- # Almost any Apache directive may go into a VirtualHost container.
- # The first VirtualHost section is used for requests without a known
- # server name.
- #
- #<VirtualHost *:80>
- # ServerAdmin [email protected]
- # DocumentRoot /www/docs/dummy-host.example.com
- # ServerName dummy-host.example.com
- # ErrorLog logs/dummy-host.example.com-error_log
- # CustomLog logs/dummy-host.example.com-access_log common
- #</VirtualHost>
大家可以依葫蘆畫瓢,也可以結合相關文法加入自己的配置說明,下面是我無憂程式的設定檔:1、* 星號修改成自己網站的IP地址 2、ServerAdmin管理員郵箱(可有可無) 3、DocumentRoot網站檔案在伺服器的目錄路徑 4、ServerName綁定相應網域名稱 5、ServerAlias泛解析綁定子網域名稱 6、ErrorLog和CustomLog指定記錄檔存放路徑。
- <VirtualHost 175.102.8.117:80>
- addDefaultCharset gbk
- DocumentRoot /chengxu
- ServerName 66php.com
- ServerAlias *.66php.com
- ErrorLog /sym/logs/66php.com-error_log
- CustomLog /sym/logs/66php.com-access_log common
- </VirtualHost>
如果一個伺服器綁定多個網域名稱不是在ServerName添加多個網域名稱,ServerName 後面只能加一個網域名稱,要重複綁定則需要添加多加多個VirtualHost模組。