標籤:style blog http color strong 檔案
【轉載請註明出處: 錢國正的專欄http://blog.csdn.net/qianguozheng/article/details/37611859】
問題:
在CentOS上安裝apache,配置好伺服器本機可以訪問,但是外部區域網路IP不能訪問
解決方案:
1.修改設定檔/etc/httpd/conf/httpd.conf
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
2.添加連接埠映射,這點是CentOS系統的安全特性,也是其適用於伺服器的原因吧。
方法<1>:直接修改防火牆設定檔(/etc/sysconfig/iptables)
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
方法<2>:命令修改
/sbin/iptables -I INPUT -p tcp --dport 3306 -jACCEPT
儲存配置
/etc/rc.d/init.d/iptables save
重啟服務
service iptables restart
或/etc/init.d/iptables restart
檢查狀態
/etc/init.d/iptables status
iptables開機自動啟動:
開啟: chkconfig iptables on 關閉: chkconfig iptables off
iptables關閉服務:
開啟: service iptables start 關閉: service iptables stop
參考
【http://tieba.baidu.com/p/1303031263】
【http://www.server110.com/linux/201308/528.html】
【http://www.2cto.com/os/201205/132884.html】
【http://www.cnblogs.com/rockee/archive/2012/05/17/2506671.html】
【轉載請註明出處: 錢國正的專欄http://blog.csdn.net/qianguozheng/article/details/37611859】