如何在Amazon EC2上创建子域?
在httpd.conf中添加虚拟主机是否足够..还是还需要做任何其他更改?
谢谢
取决于您的服务器软件。但是当你提到httpd.conf时,你很可能在Linux发行版上运行Apache。如果是这种情况那么是的,添加虚拟主机就足够了。这是一种方法:
subdomain.example.com => ec2-xx-xxx-xxx-xxx.eu-west-1.compute.amazonaws.com
NameVirtualHost *:80
httpd.conf中:
<VirtualHost *:80>
ServerName subdomain.example.com
ServerAdmin [email protected]
DocumentRoot /var/www/example.com/subdomain
<Directory /var/www/example.com/subdomain>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/subdomain.example.com.error.log
LogLevel warn
CustomLog /var/log/apache2/subdomain.example.com.access.log combined
</VirtualHost>
6.重启Apache
/etc/init.d/apache2 restart