Centos7+apache+passenger+rails4.1.6部署的伺服器實現區域網路內部訪問

來源:互聯網
上載者:User

標籤:style   blog   http   io   ar   os   sp   strong   檔案   

問題

在CentOS上安裝apache,配置好伺服器本機可以訪問,但是外部區域網路IP不能訪問

解決方案:

 1.我的項目設定檔passenger.conf

 LoadModule passenger_module /usr/local/rvm/gems/[email protected]/gems/passenger-4.0.53/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /usr/local/rvm/gems/[email protected]/gems/passenger-4.0.53
     PassengerDefaultRuby /usr/local/rvm/gems/[email protected]/wrappers/ruby
   </IfModule>
Listen 192.168.1.106:3005
   <VirtualHost *:3005>
      RailsEnv  development
      ErrorLog  /etc/httpd/logs/error_log
      ServerName 192.168.1.106
      DocumentRoot /var/www/html/rails_blog/public
      <Directory /var/www/html/rails_blog/public>
         AllowOverride all
         Options -MultiViews
      </Directory>
   </VirtualHost>


 2.添加連接埠映射,這點是CentOS系統的安全特性,也是其適用於伺服器的原因吧。

方法<1>:直接修改防火牆設定檔(/etc/sysconfig/iptables)
                -A INPUT -p tcp -m state --state NEW -m tcp --dport 3005 -j ACCEPT

方法<2>:命令修改

               /sbin/iptables -I INPUT -p tcp --dport 3005 -jACCEPT


重啟服務

service iptables restart


檢查狀態

service iptables status



iptables開機自動啟動:

開啟: chkconfig iptables on 關閉: chkconfig iptables off


iptables關閉服務:

開啟: service iptables start 關閉: service iptables stop

參考資料:http://blog.csdn.net/qianguozheng/article/details/37611859

Centos7+apache+passenger+rails4.1.6部署的伺服器實現區域網路內部訪問

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.