2012年1月11日 星期三

EC2中Apache新增虛擬主機(virtualhost)

服務平台:Amazon Web Service(AWS)
環境:Amazon Elastic Compute Cloud (Amazon EC2)

工具:putty


1)新增一個virtual.conf的檔案額外設定Apache:
[[email protected] ec2-user]# vim /etc/httpd/conf.d/virtual.conf


2)設定虛擬主機(virtual.conf)port 80所指定的虛擬主機:


NameVirtualHost *:80

3)設定虛擬主機(virtual.conf)目錄路徑及DNS名稱:



<VirtualHost *:80>
    ServerName kejyun.twbbs.org    DocumentRoot /var/kejyun
</VirtualHost>
<VirtualHost *:80>
    ServerName shihgu.twbbs.org
    DocumentRoot /var/shihgu
</VirtualHost>



3)設定虛擬主機(virtual.conf)目錄權限

<Directory "/var/kejyun">     Options FollowSymLinks     AllowOverride None     Order allow,deny     Allow from all </Directory> <Directory "/var/shihgu">     Options FollowSymLinks Indexes     AllowOverride None     Order allow,deny     Allow from all </Directory>


4)重新啟動apache讀取新設定

[[email protected] ec2-user]# /etc/init.d/httpd restart

沒有留言:

張貼留言

ADS