CentOS 配置httpd使區域網路可以正常訪問

來源:互聯網
上載者:User

標籤: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】

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.