Preparation: Updates and Upgrades These commands update your apt system with what is available in the repositories, and upgrade any packages already installed to which upgrades are available. This seems like a good thing to do on a regular basis, or at least before any software installations. Installing Apache Simple. This installs the latest version of Apache HTTP Server 2.x. At the time of this writing, that is version 2.2.14. When the process is complete the server will be started, and you should be able to test it by visiting http://<Elastic IP Address>. You should see a message "It Works!". Starting and Stopping the Server The commands are simple: These commands should be run as root. This might sound like a security hole, but it isn't... From the Apache Documentation: If the From another page of the Apache Documentation : In typical operation, Apache is started by the root user, and it switches to the user defined by the If you take a look at /etc/apache2/apache2.conf you'll find Without you even realizing it, apt created this new user www-data and set up Apache to use it for child processes. Setup A Website apt-get update
apt-get upgrade
apt-get install apache2
/etc/init.d/apache2 start
/etc/init.d/apache2 stop
/etc/init.d/apache2 reload
Listen
specified in the configuration file is default of 80 (or any other port below 1024), then it is necessary to have root privileges in order to start apache, so that it can bind to this privileged port. Once the server has started and performed a few preliminary activities such as opening its log files, it will launch several child processes which do the work of listening for and answering requests from clients. The main httpd
process continues to run as the root user, but the child processes run as a less privileged user. User
directive to serve hits. # These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
mkdir /mnt/data-store/sites
mkdir /mnt/data-store/sites/usgin
mkdir /mnt/data-store/sites/usgin/logs
mkdir /mnt/data-store/sites/usgin/www
chown root:adm /mnt/data-store/sites/usgin/logs
chmod 0750 /mnt/data-store/sites/usgin/logs
chmod 0755 /mnt/data-store/sites/usgin/www
cp /var/www/index.html /mnt/data-store/sites/usgin/www
a2ensite usgin
a2dissite default
/etc/init.d/apache2 reload