Question : 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. The storage server has a shared directory /data that is mounted on each app host under /var/www/html directory. Please perform the following steps to accomplish the task:
a. Install httpd package and dependencies on all app hosts.
b. Apache should serve on port 8080 within the apps.
c. There are two website's backups /home/thor/news and /home/thor/cluster on jump_host. Set them up on Apache in a way that news should work on link http://<<lb-url>>/ecommerce/ and cluster should work on link http://<<lb-url>>/cluster. (do not worry about load balancer configuration, as its already configured).
d. You can access the website on LBR link; to do so click on the + button on top of your terminal, select the option Select port to view on Host 1, and after adding port 80 click on Display Port.
1. At first login on app server ssh tony@stapp01
2. Switch to root user : sudo su -
3. Run Below command to install openssh service for copying scp files
[root@stapp01
~]# yum install -y openssh-clients Loaded plugins:
fastestmirror, ovl Determining
fastest mirrors * base: mirrors.vangus.co.il * extras: mirror.softaculous.com * updates: ftp.rz.uni-frankfurt.de base | 3.6
kB 00:00:00 extras
| 2.9 kB 00:00:00 updates
| 2.9 kB 00:00:00 (1/4):
base/7/x86_64/group_gz
| 153 kB 00:00:00 (2/4):
extras/7/x86_64/primary_db |
242 kB 00:00:00 (3/4):
base/7/x86_64/primary_db
| 6.1
MB 00:00:00 (4/4):
updates/7/x86_64/primary_db |
8.0 MB 00:00:00 Resolving
Dependencies --> Running
transaction check ---> Package
openssh-clients.x86_64 0:7.4p1-21.el7 will be installed --> Finished
Dependency Resolution
Dependencies
Resolved
==================================================================================================== Package Arch Version Repository Size ==================================================================================================== Installing: openssh-clients x86_64 7.4p1-21.el7 base 655 k
Transaction
Summary ==================================================================================================== Install 1 Package
Total download
size: 655 k Installed size:
2.5 M Downloading
packages: openssh-clients-7.4p1-21.el7.x86_64.rpm | 655 kB 00:00:00
Running
transaction check Running
transaction test Transaction test
succeeded Running
transaction Installing :
openssh-clients-7.4p1-21.el7.x86_64
1/1 Verifying
: openssh-clients-7.4p1-21.el7.x86_64
1/1
Installed: openssh-clients.x86_64 0:7.4p1-21.el7
Complete! [root@stapp01 ~]# |
4. Restart ssh service
systemctl restart sshd
5. Now copy the two websites folder from Jumpserver to app server
Login on Jumpserver by open new terminal
thor@jump_host
/$ scp -r /home/thor/news tony@stapp01:/tmp tony@stapp01's
password: index.html
index.html 100% 117
145.5KB/s 00:00 thor@jump_host
/$ scp -r /home/thor/cluster tony@stapp01:/tmp tony@stapp01's
password: index.html index.html
100% 118 206.8KB/s
00:00 thor@jump_host /$
|
6. Login back to app server (stapp01) & install httpd
[root@stapp01 ~]# yum install -y httpd Loaded plugins: fastestmirror,
ovl Loading mirror speeds from
cached hostfile * base: mirrors.vangus.co.il * extras: mirror.softaculous.com * updates: ftp.rz.uni-frankfurt.de Resolving Dependencies --> Running transaction
check ---> Package httpd.x86_64
0:2.4.6-97.el7.centos will be installed --> Processing Dependency:
httpd-tools = 2.4.6-97.el7.centos for package:
httpd-2.4.6-97.el7.centos.x86_64 Complete! [root@stapp01 ~]# |
7. Edit configuration file vi etc/httpd/conf/httpd.conf &
change Listen port to 8080 Please refer your task your port might be different
[root@stapp01
~]# cat /etc/httpd/conf/httpd.conf |grep Listen # Listen: Allows
you to bind Apache to specific IP addresses and/or # Change this to
Listen on specific IP addresses as shown below to #Listen
12.34.56.78:80 Listen 80 [root@stapp01
~]# [root@stapp01
~]# vi /etc/httpd/conf/httpd.conf [root@stapp01
~]# [root@stapp01
~]# cat /etc/httpd/conf/httpd.conf |grep Listen # Listen: Allows
you to bind Apache to specific IP addresses and/or # Change this to
Listen on specific IP addresses as shown below to #Listen
12.34.56.78:80 Listen 8080 [root@stapp01
~]# |
8. Start & enable the httpd service below commands
[root@stapp01
~]# systemctl enable httpd &&
systemctl start httpd && systemctl status httpd Created symlink
from /etc/systemd/system/multi-user.target.wants/httpd.service to
/usr/lib/systemd/system/httpd.service. ● httpd.service
- The Apache HTTP Server Loaded: loaded
(/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: active (running) since Thu
2021-06-10 13:49:09 UTC; 8ms ago Docs: man:httpd(8) man:apachectl(8) Main PID: 477 (httpd) Status: "Processing requests..." CGroup:
/docker/3e71843f7ef542995a1e0d8046c171842d53617d23424beb9b932af20646e5d8/system.slice/httpd.service ├─477 /usr/sbin/httpd
-DFOREGROUND ├─478 /usr/sbin/httpd
-DFOREGROUND ├─479 /usr/sbin/httpd
-DFOREGROUND ├─480 /usr/sbin/httpd -DFOREGROUND ├─481 /usr/sbin/httpd
-DFOREGROUND └─482 /usr/sbin/httpd -DFOREGROUND Jun 10 13:49:09 stapp01.stratos.xfusioncorp.com systemd[1]: Starting The Apache HTTP Server... Jun 10 13:49:09
stapp01.stratos.xfusioncorp.com httpd[477]: AH00558: httpd: Could not
reliably determi...ge Jun 10 13:49:09
stapp01.stratos.xfusioncorp.com systemd[1]: Started The Apache HTTP Server. Hint: Some lines
were ellipsized, use -l to show in full. [root@stapp01 ~]# |
9. Move copied folders from tmp to /var/www/html folder
[root@stapp01
~]# mv /tmp/news/ /var/www/html/ [root@stapp01
~]# mv /tmp/cluster/ /var/www/html/ [root@stapp01
~]# [root@stapp01
~]# ll /var/www/html/ total 8 drwxr-xr-x 2
tony tony 4096 Jun 10 13:45 news drwxr-xr-x 2
tony tony 4096 Jun 10 13:45 cluster [root@stapp01
~]# |
10. Validate the task by below command from Jumpserver
[root@stapp01 ~]#curl http://stapp01:8080/news <!DOCTYPE
HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301
Moved Permanently</title> </head><body> <h1>Moved
Permanently</h1> <p>The
document has moved <a
href="http://stapp01:8080/news/">here</a>.</p> </body></html> [root@stapp01
~]# [root@stapp01
~]# curl http://stapp01:8080/cluster <!DOCTYPE
HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301
Moved Permanently</title> </head><body> <h1>Moved
Permanently</h1> <p>The
document has moved <a
href="http://stapp01:8080/cluster/">here</a>.</p> </body></html> |
Happy Learning!!!!
0 Comments