Subject: Install Apache httpd on AWS EC2 instance
Author: Linux
Posted on: 10/13/2011 06:58:40 PM
So now we have:
A basic Linux box running in the cloud;
A public static ipAddress binding to the instance/box;
A public domain pointing to the ipAddress and hence the box;
A Tomcat container running in the box;
Now we want an extra Apache web server sitting in front of Tomcat. Why? The advantages are:
Apache is efficient in handling static contents via caching mechanism.
Apache supports multiple domains on the same ipAddress via VirtualHost
Better security by hiding Tomcat
AWS micro EC2 instance supports the yum package manager, which installs RPM packages from a repository.
# yum install httpd
The main stuff is loaded under /etc/httpd
Before starting our server, we can configure parameters in Apaches "/etc/httpd/conf/httpd.conf". For example, the default document root is:
DocumentRoot /var/www/html
You may want to change it into:
DocumentRoot /home/ec2-user/public_html
Lets create a HTML file named "test.html" in public_html directory:
<html>
<body>
<p>Apache httpd server is running on AWS EC2 instance!</p>
</body>
</html>
Now it's time to start the server:
# /etc/init.d/httpd start
If you want your server to survive box reboot:
# chkconfig httpd on
Replies:
References: