Configure mcomaster to run with Apache

Source: Internet
Author: User

The previous article introduced the deployment of the mcomaster, which is run in webrick HTTP by default and listens to port 3000. This is the same as the deployment of puppet-Dashboard mentioned earlier, it should be said that all rails programs run in this way by default.

Webrick itself is not efficient. In addition, we often do not want the server to open redundant ports. This article describes how to run the rails program in Apache mode.

1. Install passenger

Install the passenger module for Apache. you can install the passenger module using yum. Install the passenger module using gem.

# Gem install passenger find the passenger-install-apache2-module to run # passenger-install-apache2-module

 

Ii. configure a VM

A virtual host will be configured to run the mcomaster

# Vim/etc/httpd/CONF. d/passenger. confloadmodule passenger_module/usr/Ruby/lib/Ruby/gems/2.1.0/gems/Passenger-4.0.46/buildout/apache2/mod_passenger.so # adjust your environment <ifmodule supervisor> passengerroot/usr/ ruby/lib/Ruby/gems/2.1.0/gems/pasft-- 4.0.46 # Same as passengerdefaultruby/usr/Ruby/bin/ruby </ifmodule> <virtualhost 192.168.11.170: 80> servername mcomaster. wofei DocumentRoot "/usr/mcomaster-master/public/" # mcomaster path, note: Write the <directory "/usr/mcomaster-master/public/"> options none AllowOverride authconfig order allow, deny allow from all </directory> </virtualhost>

In addition, you must configure namevirtualname in/etc/httpd/CONF/httpd. conf.

NameVirtualHost 192.168.11.170:80

Restart Apache and access it. I encountered two problems during startup. If you have any problems, refer to the solution.

1. the following error is reported when Apache has the permission to execute MOD files:

Starting httpd: httpd: Syntax error on line 221 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.d/passenger.conf: Cannot load /usr/ruby/lib/ruby/gems/2.1.0/gems/passenger-4.0.46/buildout/apache2/mod_passenger.so into server: /usr/ruby/lib/ruby/gems/2.1.0/gems/passenger-4.0.46/buildout/apache2/mod_passenger.so: failed to map segment from shared object: Permission denied

Solution: http://stackoverflow.com/questions/20919771/centos-6-4-failed-to-map-segment-from-shared-object-permission-denied

2. As a result, SELinux cannot bind other ports. At first I used port 80, and the virtual host configuration of the mcomaster did not work. This error was discovered only when I switched to port 8081, after the settings are completed, the system changes back to port 80 and finds that the mcomaster can also be accessed normally.

Starting httpd: (13)Permission denied: make_sock: could not bind to address [::]:8081(13)Permission denied: make_sock: could not bind to address 0.0.0.0:8081no listening sockets available, shutting down

Solution: http://blog.itechol.com/space-33-do-blog-id-5114.html

Add the local ing at last. Try accessing it.

 

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.