Difference between revisions of "OPS345 Lab 3"
(Created page with "* www instance was created in the last lab, with a static private IP, and port fowarding done from port 2211 on router to port 22 on www. * yum install httpd iptables-services...") |
(No difference)
|
Revision as of 01:10, 22 September 2021
- www instance was created in the last lab, with a static private IP, and port fowarding done from port 2211 on router to port 22 on www.
- yum install httpd iptables-services
- enable iptables
- before starting the service, we'll configure the server to store all webpages on a separate volume: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-attaching-volume.html
- 1GB in us-east-1a
- rename to www-data
- attach to www (note reboot is not required)
- ls /dev/xvd* -l > /dev/xvdf
- vgcreate vg_www /dev/xvdf
- lvcreate -n lv_www -l 100%FREE vg_www
- blkid
- ls /dev/mapper/vg_www-lv_www
- mkfs.ext4 -L www /dev/mapper/vg_www-lv_www
- vi /etc/fstab
- /dev/mapper/vg_www-wwwLV1 /var/www ext4 defaults 0 0
- mount /var/www/
- ls /var/www/
- mount | grep /dev/xvd
- ls /var/www/
- mkdir /var/www/html
- vi /var/www/html/index.php
Hello. My web server still works.<br /> If this shows the current date and time, PHP works too:<br /> <?php system("date"); ?>
- chown -R andrew /var/www/html
- systemctl start httpd
- On router: iptables -t nat -I PREROUTING -p tcp --dport 80 -j DNAT --to 10.3.45.11:80
- On www: iptables -I INPUT 3 -p tcp --dport 80 -j ACCEPT
- service iptables save
- Edit security group, allow HTTP
- ss -atnp on router and www
- install php, restart httpd