如何在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 webmaster@subdomain.example.com 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