开发者

How to mix PHP and Rails deployment?

开发者 https://www.devze.com 2023-03-06 08:10 出处:网络
I have a CentOS VPS and deployed a few PHP apps already, i.e.: /var/www/html (some stat开发者_Go百科ic pages)

I have a CentOS VPS and deployed a few PHP apps already, i.e.:

/var/www/html (some stat开发者_Go百科ic pages)
/var/www/html/blog (wordpress blog)

Now I'd like to add an Rails app, how can that be done?


One possible way: would be to shift your static (non-php) pages inside the rails application. (That is the public folder inside your rails app). Then configure your server/domain name to have your rails app running side by side with your wordpress blog. Such that you existing blog resides at http://blog.yourdomain.com and your rails app at http://yourdomain.com. If you are using apache / passenger this is pretty straight forward with "virtual hosts". You end up with one virtual host for your rails app and another for your wordpress blog. Another option could be to try using a single virtual host but using an alias to redirect to your wordpress blog.


I don't know which http server you use. So I know how it can be done for apache and nginx:

The easiest way is to use passenger formerly known as mod_rails. This is a module/plugin for apache or nginx which can run rack applications, and rails is a rack application.

You can simply install it with

[sudo] gem install passenger

What to do after this depends on you webserver:

  • apache:

    [sudo] passenger-install-apache2-module
    
  • nginx

    [sudo] passenger-install-nginx-module
    

Both of these commands provide a pretty good discription of what to do. If you're using nginx it's possible you need to recompile the webserver, but in the case of nginx it's quite fast.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号