Simple Web Server and Page CentOS - savannahc502/SavC-TechJournal-SEC260 GitHub Wiki

CentOS Machine IP Address: 10.0.17.50/24

  • Check with ip addr

Set-Up Apache/HTTPD

  • yum install -y httpd
  • firewall-cmd --permanent --add-port=80/tcp
  • firewall-cmd --reload
  • firewall-cmd --query-port=80/tcp
  • systemctl start httpd
  • systemctl enable httpd
  • systemctl status httpd

Testing your server:

image

  • curl "http://10.0.17.50" | grep "Test Page"

image


Adding New Pages:

  • cd /var/www/html
  • vi index.html

Put in the following html script:

image

Output in browser will be:

image


Adding PHP

  • Install: yum install php php-common php-cli php-curl
  • Test: php -v
  • systemctl restart httpd
  • systemctl status httpd

Edit index.html with the following content:

image

  • Changing the extension: mv index.html index.php

Browser Navigation result:

image


Use https://www.w3schools.com/html/ to do more custom tags

image