简体   繁体   English

使用cpanel将Rails 4部署到VPS

[英]Deploying Rails 4 to VPS with cpanel

My steps 我的脚步

I'm trying to deploy my Rails 4 application to subdomain on VPS with cpanel installed. 我正在尝试将已安装cpanel的Rails 4应用程序部署到VPS上的子域。

I added a subdomain msystem.mydomain.com in cpanel GUI. 我在cpanel GUI中添加了子域msystem.mydomain.com。 Root directory set to "/home/web/public_html/msystem". 根目录设置为“ / home / web / public_html / msystem”。

Next I install RVM, ruby 2.1.2, rails 4 and passenger. 接下来,我安装RVM,ruby 2.1.2,rails 4和乘客。

Then added 然后添加

LoadModule passenger_module /usr/local/rvm/gems/ruby-2.1.2/gems/passenger-4.0.45/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-2.1.2/gems/passenger-4.0.45
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.1.2/wrappers/ruby
PassengerResolveSymlinksInDocumentRoot on

to pre_main_2.conf in cpanel GUI (there is installed only apache 2.2.26). 到cpanel GUI中的pre_main_2.conf(仅安装了Apache 2.2.26)。

Then I made all the RVM files world-readable 然后,我将所有RVM文件都变得世界可读

chmod ugo+rX -R /usr/local/rvm

In the /usr/local/apache/conf/userdata/std/2_2/web/msystem.mydomain.com/msystem.conf I added line /usr/local/apache/conf/userdata/std/2_2/web/msystem.mydomain.com/msystem.conf我添加了一行

DocumentRoot /home/web/public_html/msystem/public/

Then bundle install --deployment , rake db:migrate . 然后bundle install --deploymentrake db:migrate

I used Dave James Miller and blog.barrioearth.com tutorials. 我使用了Dave James Millerblog.barrioearth.com教程。

Problem 问题

msystem.mydomain.com/ is redirecting to msystem.mydomain.com/cgi-sys/defaultwebpage.cgi msystem.mydomain.com/重定向到msystem.mydomain.com/cgi-sys/defaultwebpage.cgi


UPDATE UPDATE

Apache redirects only '/' request. Apache仅重定向“ /”请求。 With other routes it works right way. 对于其他路线,它的工作方式正确。 There is a root route in config/routes.rb : config/routes.rb有一个根路由:

root 'categories#index'

My virtual host in httpd.conf looks like: http://pastebin.com/hRgSRD6A 我在httpd.conf中的虚拟主机看起来像: http : //pastebin.com/hRgSRD6A

I solved the problem. 我解决了问题。 It was DNS or browser cache issue. 这是DNS或浏览器缓存问题。 On other computers '/' route works well. 在其他计算机上,“ /”路由运行良好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM