如何配置 apache 来运行 Django (mod_WSGI) 和 Rails (Passenger)
我只使用 apache2 mod_WSGI 运行 django 应用程序,但现在我想将 Rails(乘客)应用程序添加到同一服务器。我安装了 Passenger,它工作正常。
经过搜索,我找到了一种在 www.myserver.com 上运行它的方法,所以我有:
- www.myserver.com -> Rails 应用程序
- www.myserver.com/app1 -> django 应用程序 1
- www.myserver.com/app2 -> django app 2
问题是我不知道如何配置 httpd.conf 文件来运行,例如:www.myserver.com/myrailsapp ->导轨应用程序。
我使用的是 Ubuntu Server 10.04 和 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>
在行: Include /etc/apache2/rails.conf
DocumentRoot /home/user/ruby/projects/redmine/public
<IfDefine PASSENGER>
RailsBaseURI /redmine
</IfDefine>
这个包含 (rails.conf) 是使 Rails 应用程序运行的原因,但我可以将任何内容放在“RailsBaseURI /redmine”上但没有任何改变。
问:如何将 www.myserver.com/redmine 重定向到 /home/user/ruby/projects/redmine/public ?
欢迎任何帮助。 谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用乘客为阿帕奇和
apache2-mod-python ( sudo apt-get install apache2-mod-python ) 用于 django 部分。
它对我有用;)
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 ;)