简体   繁体   中英

How to config apache to run Django (mod_WSGI) and Rails (Passenger)

I was running only my django applications with apache2 mod_WSGI but now I want to add Rails (Passenger) applications to the same server. I installed Passenger and it's working fine.

After searched while I found a way to run it on www.myserver.com so I have:

  • www.myserver.com -> rails app
  • www.myserver.com/app1 -> django app 1
  • www.myserver.com/app2 -> django app 2

The problem is I don't know how to config httpd.conf file to run for example: www.myserver.com/myrailsapp -> rails app.

I'm on Ubuntu Server 10.04 and Apache2

httpd.conf:

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
PassengerRuby /usr/bin/ruby
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.2/
Include /etc/apache2/rails.conf

<VirtualHost www.myserver.com:80>
   ServerName www.myserver.com.com

   WSGIScriptAlias /hello /home/user/django/projects/hello/hello.wsgi
   <Directory /home/user/django/projects/hello>
      Order allow,deny
      Allow from all
   </Directory>

   WSGIScriptAlias /app1 /home/user/django/projects/app1/app1.wsgi
   <Directory /home/user/django/projects/app1>
      Order allow,deny
      Allow from all
   </Directory>

   Alias /static/admin /home/user/django/src/django/contrib/admin/media

   ErrorLog /home/usero/django/projects/logs/error.log
   CustomLog /home/user/django/projects/logs/access.log combined
</VirtualHost>

At line: Include /etc/apache2/rails.conf

DocumentRoot /home/user/ruby/projects/redmine/public
<IfDefine PASSENGER>
    RailsBaseURI /redmine
</IfDefine>

This include (rails.conf) is what made the Rails app run but I can put anything on 'RailsBaseURI /redmine' but nothing changes.

Q: How can I do www.myserver.com/redmine redirects to /home/user/ruby/projects/redmine/public ?

Any help is welcome. Thanks.

Use passenger for the rails support for Apache and apache2-mod-python ( sudo apt-get install apache2-mod-python ) for the django part. It worked with me ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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