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