Need advice on deploying my first rails app to a mediatemple (dv)

前端 未结 1 457
伪装坚强ぢ
伪装坚强ぢ 2021-02-04 21:53

I\'m trying to deploy my first rails app on a mediatemple (dv) and i\'m not having any luck.

I\'m trying to use phusion passenger so i went over to http://www.modrails.c

相关标签:
1条回答
  • 2021-02-04 22:42

    I've just go this done on my dv server so here is a quick walk through. I will assume that you are working with Ruby 1.9.3 and Rails 3.2, and running all of the commands below as root.

    You also have the latest version of rake and passenger install on your server. If not, try:

    gem update --system
    gem install rake
    gem install passenger
    

    Next step is to login to your MediaTemple admin panel. Click on the Admin button (not the Plesk one) for the domain you are interested and choose "Root Access and Developer Tools" option. Install the developer tools (this will take about 10mins).

    Once that's done, ssh into your server and do the following:

    passenger-install-apache2-module
    

    There is a pretty good guided installation so I won't go into details here. You may need to install some additional dependencies here via yum so check the output of this script carefully.

    Once that's out of the way, go and edit your httpd.conf file. This is saved under /etc/httpd/conf/httpd.conf. You will want to add the following lines to the end of it (please note the paths may vary as I am using rvm to manage my ruby installations and gemsets).

    # Passenger Module for Apache (For Rails apps)
    LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p125@rails32/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
    PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p125@rails32/gems/passenger-3.0.11
    PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p125@rails32/ruby
    PassengerDefaultUser root
    

    At this point you should be ready to create a new rails app so remove everything from your httpdocs folder and issue the following command while logged in as the domain user (not root!)

    rails new /path/to/httpdocs
    

    Edit your vhost.conf file (or create a new one) in /var/www/vhosts/www.domain.com/conf (you will need to do this as root).

    ServerName domainname.com
    ServerAlias domainname.com
    DocumentRoot /var/www/vhosts/domainname.com/httpdocs/public
    <Directory "/var/www/vhosts/domainname.com/httpdocs/public">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>
    RailsEnv development
    RailsBaseURI /
    

    And finally, issue

    /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain xxx.xx.xx.xx
    

    And restart apache

    /usr/sbin/apachectl -k restart
    

    That should be it!

    This link really helped me with the whole thing: http://www.twohard.com/blog/setting-rails-passenger-mediatemple-dv35-servers

    0 讨论(0)
提交回复
热议问题