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:
curl "http://10.0.17.50" | grep "Test Page"
- Navigating to http://10.0.17.50
Adding New Pages:
cd /var/www/html
vi index.html
Put in the following html script:
Output in browser will be:
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:
- Changing the extension:
mv index.html index.php
Browser Navigation result:
Use https://www.w3schools.com/html/ to do more custom tags