Centos7 + apache + passenger + rails4.1.6 deployed servers for internal LAN Access

Source: Internet
Author: User

Centos7 + apache + passenger + rails4.1.6 deployed servers for internal LAN Access
Problem:

Install apache on CentOS. The server can be accessed on the local machine after configuration, but the IP address of the external LAN cannot be accessed.

Solution:

1. My project configuration file passenger. conf

LoadModule passenger_module/usr/local/rvm/gems/ruby-2.0.0-p598 @ rails416/gems/passenger-4.0.53/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot/usr/local/rvm/gems/ruby-2.0.0-p598 @ rails416/gems/passenger-4.0.53
PassengerDefaultRuby/usr/local/rvm/gems/ruby-2.0.0-p598 @ rails416/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. Add port ing. This is the security feature of the CentOS system and is also the reason why it applies to servers.

Method <1>: directly modify the firewall configuration file (/etc/sysconfig/iptables)
-A input-p tcp-m state -- state NEW-m tcp -- dport 3005-j ACCEPT

Method <2>: Modify the command

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


Restart service

Service iptables restart

Check status

Service iptables status

 

Iptables automatically starts upon startup:

Enable: chkconfig iptables on Disable: chkconfig iptables off


Disable the service using iptables:

Enable: service iptables start Disable: service iptables stop

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.