Register a subdomain in amazon ec2 server
Assume that you have a domain of example.com that you have purchase.
/etc/init.d/apache2 restart
1 Find the external IP or DNS for your EC2 instance. You probably want to associate an Elastic IP to your instance, otherwise the IP of your instance will change on reboots.
2 Create a DNS record for your domain, for instance a CNAME record to point to your Elastic IP/DNS name:
subdomain.example.com => ec2-xx-xxx-xxx-xxx.eu-west-1.compute.amazonaws.com
3 Make sure your httpd.conf contains a line to allow virtual hosts:
NameVirtualHost *:80
4 Create a virtual host directive:
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>
5 Restart Apache
2 Create a DNS record for your domain, for instance a CNAME record to point to your Elastic IP/DNS name:
subdomain.example.com => ec2-xx-xxx-xxx-xxx.eu-west-1.compute.amazonaws.com
3 Make sure your httpd.conf contains a line to allow virtual hosts:
NameVirtualHost *:80
4 Create a virtual host directive:
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>
5 Restart Apache
/etc/init.d/apache2 restart
Comments
Post a Comment