CentOS - Webserver Configuration
Check httpd service
#service httpd status
Start httpd service
#service httpd start
#service httpd status
Start httpd service
#service httpd start
Set to AllowOverride All
#nano /etc/httpd/conf/httpd.conf
From :
Options FollowSymLinks
AllowOverride None
#nano /etc/httpd/conf/httpd.conf
From :
Options FollowSymLinks
AllowOverride None
To :
Options FollowSymLinks
AllowOverride All
Options FollowSymLinks
AllowOverride All
Add iptables rule for port 80 (http)
#iptables -I INPUT 5 -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
Check iptables rule
#iptables -L INPUT --line-numbers
Example output :
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
2 ACCEPT icmp -- anywhere anywhere
3 ACCEPT all -- anywhere anywhere
4 ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
5 ACCEPT tcp -- anywhere anywhere tcp dpt:http state NEW,ESTABLISHED
6 REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
#iptables -I INPUT 5 -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
Check iptables rule
#iptables -L INPUT --line-numbers
Example output :
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
2 ACCEPT icmp -- anywhere anywhere
3 ACCEPT all -- anywhere anywhere
4 ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
5 ACCEPT tcp -- anywhere anywhere tcp dpt:http state NEW,ESTABLISHED
6 REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Save iptables rule
#service iptables save
To ensure that httpd start every time system restarted
#chkconfig httpd on
iptables rule successfully added in line 5, so we should have access to apache webserver page.
#service iptables save
To ensure that httpd start every time system restarted
#chkconfig httpd on
iptables rule successfully added in line 5, so we should have access to apache webserver page.
So if you would like to delete second rule :
#iptables -D INPUT 2
#iptables -D INPUT 2
No comments