2011/06/29

rsyslog

rsyslog + logwatch

Reference:
01. http://wiki.rsyslog.com
02. http://linuxdiary.blogspot.com/2008/10/logwatch.html

關於 log 檔

/var/log
/var/log/dmesg
/var/log/message
/var/log/mail.log
/var/log/apache2/

2011/06/22

設定 Apache 的 Virtual Host

環境:RHEL 6.0
目錄:/etc/httpd

編輯 /etc/httpd/conf/httpd.conf,確定 vhost 模組有載入,然後取消該行注解:
#NameVirtualHost *:80

在該行後面加上:
Include vhosts/*.conf

會是這樣:
NameVirtualHost *:80
Include vhosts/*.conf
基本上是為了要保持其它的 Virtual Hosts 設定都在 NameVirtualHost *:80 之後再載入。

手動在 /etc/httpd 底下建立一個 vhosts 資料夾,
/etc/httpd/vhosts 資料夾內放置各個 Virtual Hosts 的設定。

可以先建立一個以 IP 作為 Domain Name 指向預設 DocumentRoot 的設定。
例如該 httpd 主機的 IP 是 192.168.1.100,預設 DocumentRoot 是 /var/www/html,
則建立:
/etc/httpd/vhosts/192.168.1.100.conf
<VirtualHost *:80>
     ServerName 192.168.1.100
     DocumentRoot /var/www/html
     ErrorLog logs/192.168.1.100-error_log
     CustomLog logs/192.168.1.100-access_log common
</VirtualHost>

假設要設定一個叫 abc.example.com 的 Domain Name 指向 /var/www/html/abc,
則建立:
/etc/httpd/vhosts/abc.example.com.conf
<VirtualHost *:80>
     ServerName abc.example.com
     DocumentRoot /var/www/html/abc
     ErrorLog logs/abc.example.com-error_log
     CustomLog logs/abc.example.com-access_log common
</VirtualHost>

重新啟動 httpd 服務。

Reference:
01. http://freebsd.lab.mlc.edu.tw/apache/VirtualHost.shtml
02. http://phorum.study-area.org/index.php?topic=17120.0
03. http://wiki.ubuntu.org.cn/index.php?title=Apache%E8%99%9A%E6%8B%9F%E4%B8%BB%E6%9C%BA%E6%8C%87%E5%8D%97&variant=zh-tw