Post

Day 19 of 100 Days of Devops

Install and Configure Web Application

Day 19 of 100 Days of Devops

xFusionCorp Industries is planning to host two static websites on their infra in Stratos Datacenter. The development of these websites is still in-progress, but we want to get the servers ready. Please perform the following steps to accomplish the task:

a. Install httpd package and dependencies on app server 2.

b. Apache should serve on port 3002.

c. There are two website’s backups /home/thor/media and /home/thor/apps on jump_host. Set them up on Apache in a way that media should work on the link http://localhost:3002/media/ and apps should work on link http://localhost:3002/apps/ on the mentioned app server.

d. Once configured you should be able to access the website using curl command on the respective app server, i.e curl http://localhost:3002/media/ and curl http://localhost:3002/apps/

Copy the backup files to appserver 2 using SCP

I’d prefer to use my own ssh key rather than password as it takes time to hop servers

1
2
3
4
5
ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa -N ""
ssh-copy-id username@servername

scp /home/thor/media username@servername:/path/to/destination/
scp /home/thor/apps username@servername:/path/to/destination/

Configuring app server 2

Install httpd

1
sudo yum install httpd -y

then make sure to move copied folders under /var/www/html

then configure the virtual host under /etc/httpd/conf/httpd.conf

Add the following virtual host config at the bottom of the file. For more referene https://httpd.apache.org/docs/2.4/mod/core.html#virtualhost

1
2
3
4
5
6
7
<VirtualHost *:3002>
    DocumentRoot /var/www/html
    <Directory "/var/www/html">
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Since the folders /var/www/html/media and /var/www/html/apps already exist, Apache will automatically serve them as subdirectories.

Verification

curl http://stapp02:3002/apps

curl http://stapp02:3002/media

Thats all for today!. Thx Bye

This post is licensed under CC BY 4.0 by the author.