other Rails apps on same box as Redmine
Added by Matt Cushing about 16 years ago
Right now I have Redmine up and running WOO HOO!!! Couldn't be happier.
As I am using Redmine to show the capabilities of Ruby and Rails, I'd like to install other apps (which I haven't built yet) on the same box. As it stands now, if I navigate to the IP address, I can see Redmine perfectly.
If I create another directory in /var/www, how would I navigate to it since the IP goes right to the /var/www/redmine directory? I am asking here because the LAST thing I want to do is mess up my Redmine install :)
Replies (4)
RE: other Rails apps on same box as Redmine
-
Added by Eric Davis about 16 years ago
Just like any other website, you can use name based virtual hosts to have multiple applications on the same server. For example I'm hosting my Redmine, my website, and my blog on the same ip address. All Rails applications.
Eric
RE: other Rails apps on same box as Redmine
-
Added by Matt Cushing about 16 years ago
how did you do that tho? Did you set up a file inside sites-available?
I'd like to be able to set it up so that it would be something along the lines of
rubyServer01/redmine
rubyServer01/app1
rubyServer01/app2
Right now I don't have anything in there.
RE: other Rails apps on same box as Redmine
-
Added by Eric Davis about 16 years ago
how did you do that tho? Did you set up a file inside sites-available?
Exactly. Here is part of my Apache 2.2 setup. It includes 3 Ruby on Rails sites with some complex rewrite rules but you should be able to pull our the parts that you need:
- Redmine - uses HTTPS
- theAdmin blog - at theadmin.org
- Little Stream Software - at www.littlestreamsoftware.com
# Redmine, redirect to the SSL version
<VirtualHost *:80>
ServerName projects.littlestreamsoftware.com
RewriteEngine On
# Redirect any non HTTPS requests to the HTTPS server
RewriteCond %{HTTP_HOST} ^projects.littlestreamsoftware.com$ [NC]
RewriteRule ^(.*)$ https://projects.littlestreamsoftware.com$1 [R=301,L]
Include /etc/apache2/common/hide-svn
Include /etc/apache2/common/deflate
</VirtualHost>
# Redmine with SSL
NameVirtualHost *:443
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/apache2/apache.pem
RequestHeader set X_FORWARDED_PROTO 'https'
ServerAdmin webmaster@localhost
RewriteEngine On
DocumentRoot /home/websites/projects.littlestreamsoftware.com/current/public
<Directory "/home/websites/projects.littlestreamsoftware.com/current/public">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Proxy balancer://redmine_cluster>
BalancerMember http://127.0.0.1:12000
</Proxy>
ProxyPass / balancer://redmine_cluster/
ProxyPassReverse / balancer://redmine_cluster/
# These directories should always be served up by Apache, since they contain static content. Or just let rails do it.
ProxyPass /images !
ProxyPass /stylesheets !
ProxyPass /javascripts !
ProxyPass /favicon.ico !
# Check for maintenance file and redirect all requests
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]
# Rewrite index to check for static
RewriteRule ^/$ /cache/index.html [QSA]
# Rewrite to check for Rails cached page
RewriteRule ^([^.]+)$ /cache/$1.html [QSA]
# Redirect all non-static requests to cluster
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://redmine_cluster%{REQUEST_URI} [P,QSA,L]
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/admin-access.log combined
ServerSignature Off
Include /etc/apache2/common/hide-svn
Include /etc/apache2/common/deflate
</VirtualHost>
# Mephisto Blog
# Also includes blog.whatsyourhabit.com
<VirtualHost *:80>
ServerName theadmin.org
ServerAlias www.theadmin.org
ServerAlias blog.whatsyourhabit.com
RewriteEngine On
DocumentRoot /home/websites/theadmin.org/current/public
<Directory "/home/websites/theadmin.org/current/public">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Proxy balancer://mongrel_cluster>
BalancerMember http://127.0.0.1:8000
</Proxy>
ProxyPass / balancer://mongrel_cluster/
ProxyPassReverse / balancer://mongrel_cluster/
# These directories should always be served up by Apache, since they contain static content. Or just let rails do it.
ProxyPass /images !
ProxyPass /stylesheets !
ProxyPass /javascripts !
ProxyPass /favicon.ico !
# Make sure people go to www.myapp.com, not myapp.com
RewriteCond %{HTTP_HOST} ^www.theadmin.org$ [NC]
RewriteRule ^(.*)$ http://theadmin.org$1 [R=301,L]
# Yes, I've read no-www.com, but my site already has much Google-Fu on
# www.blah.com. Feel free to comment this out.
# Check for maintenance file and redirect all requests
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]
# Redirect for Typo permalinks
RewriteRule ^/articles/(\d*)/[0](.)/(.*) articles/$1/$2/$3 [R=301,L] # Strip off the leading 0 from the month
RewriteRule ^/articles/tag/(.*) tags/$1 [R=301,L]
RewriteRule ^/articles/category/(.*) tags/$1 [R=301,L]
RewriteRule ^/category/(.*) tags/$1 [R=301,L]
RewriteRule ^/xml/(.*) http://feeds.feedburner.com/theadmin [R=301,L]
# asset redirection
# url starts with /assets/
# check to see if file exists in the correct assets directory
# if so, then rewrite the request and end the rule with L
RewriteCond %{REQUEST_URI} ^/assets/.*$
RewriteCond %{DOCUMENT_ROOT}/assets/%{HTTP_HOST}/$1 -f
RewriteRule ^/assets/(.*)$ /assets/%{HTTP_HOST}/$1 [QSA,L]
# index redirection
# url is /
# check to see if the index.html file exists in the correct cache
# if so, then rewrite the request and end the rule with L
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}/index.html -f
RewriteRule ^/(.*)$ /cache/%{HTTP_HOST}/index.html [QSA,L]
# content redirection
# url is anything after / without a .
# check to see if the request with .html added to it exists in the correct cache
# if so, then rewrite the request and end the rule with L
RewriteCond %{REQUEST_URI} ^/[^.]+$
RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}%{REQUEST_FILENAME}.html -f
RewriteRule ^/(.*)$ /cache/%{HTTP_HOST}%{REQUEST_FILENAME}.html [QSA,L]
# other redirection
# url is anything else after / can include a dot, such as a .jpg or .css
# check to see if the requested file exists in the correct cache
# if so, rewrite the request and end the rule with L
RewriteCond %{REQUEST_URI} ^/.+$
RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}%{REQUEST_FILENAME} -f
RewriteRule ^/(.*)$ /cache/%{HTTP_HOST}%{REQUEST_FILENAME} [QSA,L]
# Everything else goes to mongrel via the load balancer proxy
RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_FILENAME} [P,QSA,L]
ErrorLog /home/edavis/logs/theadmin/web/error.log
CustomLog /home/edavis/logs/theadmin/web/access.log combined
Include /etc/apache2/common/hide-svn
Include /etc/apache2/common/deflate
</VirtualHost>
# Custom application for www.littlestreamsoftware.com
<VirtualHost *:80>
ServerName littlestreamsoftware.com
ServerAlias www.littlestreamsoftware.com
RewriteEngine On
DocumentRoot /home/websites/littlestreamsoftware.com/current/public
<Directory "/home/websites/littlestreamsoftware.com/current/public">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Proxy balancer://littlestreamsoftware_cluster>
BalancerMember http://127.0.0.1:9000
</Proxy>
ProxyPass / balancer://littlestreamsoftware_cluster/
ProxyPassReverse / balancer://littlestreamsoftware_cluster/
# These directories should always be served up by Apache, since they contain static content. Or just let rails do it.
ProxyPass /images !
ProxyPass /stylesheets !
ProxyPass /javascripts !
ProxyPass /favicon.ico !
# Make sure people go to www.myapp.com, not myapp.com
RewriteCond %{HTTP_HOST} ^littlestreamsoftware.com$ [NC]
RewriteRule ^(.*)$ http://www.littlestreamsoftware.com$1 [R=301,L]
# Yes, I've read no-www.com, but my site already has much Google-Fu on
# www.blah.com. Feel free to comment this out.
# Check for maintenance file and redirect all requests
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]
# Rewrite index to check for static
RewriteRule ^/$ /cache/index.html [QSA]
# Rewrite to check for Rails cached page
RewriteRule ^([^.]+)$ /cache/$1.html [QSA]
# Redirect all non-static requests to cluster
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://littlestreamsoftware_cluster%{REQUEST_URI} [P,QSA,L]
ErrorLog /home/edavis/logs/littlestreamsoftware/web/error.log
CustomLog /home/edavis/logs/littlestreamsoftware/web/access.log combined
Include /etc/apache2/common/hide-svn
Include /etc/apache2/common/deflate
</VirtualHost>
RE: other Rails apps on same box as Redmine
-
Added by Haider Naqvi almost 16 years ago
I am able to setup the rewrites for redmine http://blazesoft.net/projects/. However, redmine is expects css, js here http://blazesoft.net. However, they are at http://blazesoft.net/projects. How do I fix this?