I'm working on setting up a pair of redmine instances on a single server under apache.
The first worked fine and I have a virtualhost set up for it with the following vhost config:
<VirtualHost *:80>
ServerName tickets.domain.com
DocumentRoot /var/www/redmine
RailsEnv production
RailsBaseURI /
PassengerResolveSymlinksInDocumentRoot on
</VirtualHost>
The second I needed to setup as a subdirectory off of the main default site:
Alias /ops/ "/var/www/ops/"
<Directory "/var/www/ops/">
RailsEnv ops
RailsBaseURI /ops
PassengerResolveSymlinksInDocumentRoot on
</Directory>
So server/ops is the url for the second instance.
The trouble I'm having is that when I restart apache, whichever url you hit first seems to "win" and it breaks the other instance of the site. If I hit the /ops url then it loads just fine, but going to tickets. will cause me to get permission denied errors because all of the urls have /ops in them (for the JS and other files)
If I restart apache and hit the tickets. site first, it loads just fine but then I get 404 errors from Redmine on the /ops url.
This is on Ubuntu with a redmine PPA and both /var/www/ops and /var/www/redmine are symlinks to the shared redmine source code with their own environments defined (production and ops).
Any hints on how I can make these two live side by side successfully?
Thanks
this is my apache configuration hosting multiple redmine instances (domain.tld/dev1, domain.tld/dev2, ...).
You also have to change :key and :session_path in config/initializers/session_store.rb of each redmine setup.
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
Servername domain.tld
ServerAdmin webmaster#domain.tld
DefaultInitEnv RAILS_ENV production
DefaultInitEnv GEM_PATH /var/lib/gems/1.8
DocumentRoot /var/www/default-ssl
<Directory /var/www/default-ssl>
AuthType Basic
AuthName "secure section"
AuthUserFile /etc/apache2/htpasswd
Require valid-user
Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
ErrorDocument 500 "Application error Rails application failed to start properly"
AllowOverride None
Order allow,deny
allow from all
</Directory>
LogLevel warn
ErrorLog /ssl_error.log
CustomLog /ssl_access.log combined
ServerSignature Off
SSLEngine on
SSLCertificateFile /etc/ssl/certs/domain.tld.crt
SSLCertificateKeyFile /etc/ssl/private/domain.tld.key
SSLCACertificateFile /etc/ssl/certs/domain.tld.ca
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
BrowserMatch "MSIE [2-6]" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
Alias /dev1 /var/www/default-ssl/dev1/public
<Directory /var/www/default-ssl/dev1/public>
PassengerAppRoot /var/www/default-ssl/dev1
RailsBaseURI /dev1
Require user user1 user2
</Directory>
Alias /dev2 /var/www/default-ssl/dev2/public
<Directory /var/www/default-ssl/dev2/public>
PassengerAppRoot /var/www/default-ssl/dev2
RailsBaseURI /dev2
Require user user1
</Directory>
...
</VirtualHost>
</IfModule>
passenger distingues configs based on paths. Please take a look into the Ubuntu bug database:
Multiple instance of redmine does not work with passenger
create directories for every config:
/var/lib/redmine/*configname*
create symlink from redmine dir:
ln -s /usr/share/redmine /var/lib/redmine/*configname*/passenger
in your apache virtual host you can add alternative PassengerAppRoot:
PassengerAppRoot /var/lib/redmine/*configname*/passenger
Related
I have installed mod_passenger (passenger-install-apache2-module) and have the following in my Apache configuration:
LoadModule passenger_module /var/www/html/vendor/bundle/ruby/2.2.0/gems/passenger-5.0.24/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /var/www/html/vendor/bundle/ruby/2.2.0/gems/passenger-5.0.24
PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-2.2.2/ruby
</IfModule>
RackEnv production
<VirtualHost *:80>
ServerName domain.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /var/www/html/public
<Directory /var/www/html/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
</Directory>
</VirtualHost>
My Rails website is working however some URLs that end in .php or .txt do not get processed by Passenger resulting in a generic 404 page instead of the nicely formatted 404 page on my Rails site.
How can I route all file extensions to Passenger/Rails?
Or how can I make URLs that end in .php actually be processed by PHP.
I am deploying a ruby-on-rails application.
I have configured apache and passenger and the http server is listening on port 80.
When I try to access the home page using the browser, I simply get a list of files and directories instead of the home page.
Following are snippets from the apache config.
/etc/apache2/apache2.conf
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>
/etc/apache2/httpd.conf
LoadModule passenger_module /home/user1/.rvm/gems/ruby-2.3.0/gems/passenger-5.0.27/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /home/user1/.rvm/gems/ruby-2.3.0/gems/passenger-5.0.27
PassengerDefaultRuby /home/user1/.rvm/gems/ruby-2.3.0/wrappers/ruby
</IfModule>
/etc/apache2/sites-available/ubuntuvm-4.conf
<VirtualHost *:80>
ServerAdmin admin#ubuntuvm-4.com
ServerName ubuntuvm-4
ServerAlias www.ubuntuvm-4.com
DocumentRoot /home/user1/www/myapp/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
What is going wrong?
Could it be that I am trying to access the page via the ip address
http://192.168.0.12?
If you want me to put any other config, please shout.
try to copy the content of the file /etc/apache2/sites-available/ubuntuvm-4.conf
to /etc/apache2/sites-enabled/ubuntuvm-4.conf
cp /etc/apache2/sites-available/ubuntuvm-4.conf /etc/apache2/sites-enabled/ubuntuvm-4.conf
You need to create your config like this
<VirtualHost *:80>
ServerName ubuntuvm-4
<Location /home/user1/www/myapp/public>
PassengerBaseURI /
PassengerAppRoot /home/user1/www/myapp
</Location>
DocumentRoot /home/user1/www/myapp/public
<Directory /home/user1/www/myapp/public>
AllowOverride all
RailsEnv production
# MultiViews must be turned off.
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
Require all granted
</Directory>
</VirtualHost>
I had the same problem trying to deploy a 4.2.1 Rails app on Ubuntu 12.04 using Ruby 2.3.2 (RVM because .deb packaged version is damn too old !!) Apache 2.2 and Passenger 5.0.4 (.deb).
Well, after wasting days to try to figure out why passenger wouldn't start (I did this a thousand times, it always worked), I realized it was only because Passenger couldn't print its logs anywhere. So, if you already tried everything you read on forums, just try to add a path to a log file in your apache configuration :
PassengerLogFile /var/log/passenger.log
and it worked like magic. Hope this helps.
This is driving me nuts.
I have 2 different rails app running on the same redhat server. The web server is apache and app server is passenger 5.0
App1 - rails 3.0.2 and ruby 1.9.3
App2- rails 2.0.3 & ruby 1.8.7
App1 works fine and this is the configuration:
<VirtualHost *:8081>
ServerName server-xyz
RailsEnv test
DocumentRoot /webapps/test/app1/current/public
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Now when I run app2 it takes me to the default apache page and gives me the following error:
Directory index forbidden by Options directive:
/webapps/test/app2/current/public/
This is the virtual host for app2:
<VirtualHost *:8081>
ServerName server-xyz
RailsEnv test
DocumentRoot /webapps/test/app2/current/public
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
This is the common passgenger configuration:
LoadModule passenger_module /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/passenger-5.0.8/buildout/apache2/mod_passenger.so
PassengerRoot /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/passenger-5.0.8
PassengerDefaultRuby /opt/ree-1.8.7/bin/ruby_with_env
PassengerLogLevel 1
PassengerMaxPoolSize 10
Anyone has any ideas why it works for ruby.1.9.3 app and not for ruby 1.8.7?
I tried following similar threads but couldnt get it to work.
EDIT: I gave 'apache' write permissions to that path. Didn't seem to help.
EDIT 2: I found the following .htaccess configuration under public:
/webapps/test/app2/releases/20150622171404/public/.htaccess
# General Apache options
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI
RewriteEngine On
# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
# Alias /myrailsapp /path/to/myrailsapp/public
# RewriteBase /myrailsapp
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
If you are on passenger 5 and running ruby 1.8.7 & rails 2 app, you need to add a config.ru to the root of your application:
# config.ru
# Require your environment file to bootstrap Rails
require ::File.dirname(__FILE__) + '/config/environment'
# Serve static assets from RAILS_ROOT/public directory
# use Rails::Rack::Static
# Dispatch the request
run ActionController::Dispatcher.new
For the second application configuration, update it with:
<VirtualHost *:8081>
ServerName server-xyz
RailsEnv test
DocumentRoot /webapps/test/app2/current/public
<Directory />
Options FollowSymLinks Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
and check the filesystem that you don't have a .htaccess file with custom configuration for the Indexes option either on the app directory or on a upper directory
If you are using ruby 1.8.7 and Rails 2.X. I found the easiest option was to downgrade from passenger 5 to passenger 4.0.59.
My requirement is to access http://myhost/ for my ROR project and access phpmyadmin and bugzilla using http://myhost/phpmyadmin/ and http://myhost/bugzilla/.
I wonder how to configure my VirtualHost and DocumentRoot, thanks for your comments!
Content of my /etc/httpd/conf/httpd.conf
LoadModule passenger_module /usr/lib/ruby/gems/1.9.1/gems/passenger-3.0.14/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.9.1/gems/passenger-3.0.14
PassengerRuby /usr/bin/ruby
.....
.....
<VirtualHost *:80>
ServerName myhost
DocumentRoot /var/www/html/myProject/public
RailsEnv development
<Directory /var/www/html/myProject/public>
AllowOverride All
Options -MultiViews
</Directory>
</VirtualHost>
After digging the Passenger documents, I find there is a simple way to do so
<VirtualHost *:80>
ServerName myhost
DocumentRoot /var/www/html/myProject/public
RailsEnv development
<Directory /var/www/html/myProject/public>
AllowOverride All
Options -MultiViews
</Directory>
Alias /blog /var/www/html/phpmyadmin
<Location /phpmyadmin>
PassengerEnabled off
</Location>
</VirtualHost>
This will enforce Passenger to skip request under path /phpmyadmin
The easiest way, and with least amount of headaches would to just create subdomains for phpmyadmin and bugzilla. Then, just create a new virutalhost for each subdomain.
But, if your setup is necessary this seems like I possible solution.
http://macdiggs.com/2007/06/29/using-php-inside-rails-structure-on-apache/
I'm trying to add the Rails application to the a directory of another application and for some reason the rails application is not rendering
Here's a link to my application
Here's VHOST
<VirtualHost 184.106.111.142:80>
ServerAdmin joe#joe.com
ServerName transprintusa.com/design
# ServerAlias
DocumentRoot /srv/www/www.transprintusa.com/design/design.transprintusa.com/current/public
ErrorLog /srv/www/design.transprintusa.com/logs/error.log
RailsEnv production
<Directory "/srv/www/www.transprintusa.com/design/design.transprintusa.com/current/public">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
but the Rails application is showing all the files.
Passenger and everything is installed on this server because the Rails site was at design.transprintusa.com. Any ideas on what I'm doing wrong?
If there is anything I can give to help anyone help me
UPDATE - Here is my new VHOST and still displays the rails files
<VirtualHost 184.106.111.142:80>
ServerAdmin jom#jom.com
ServerName transprintusa.com
ServerAlias www.transprintusa.com
DocumentRoot /srv/www/www.transprintusa.com/
ErrorLog /srv/www/www.transprintusa.com/logs/error.log
CustomLog /srv/www/www.transprintusa.com/logs/access.log combined
<Directory "/srv/www/www.transprintusa.com/">
AllowOverride all
Options -MultiViews
</Directory>
RailsBaseURI /rails
<Directory /srv/www/www.transprintusa.com/design>
Options -MultiViews
</Directory>
</VirtualHost>
It doesn't work in this way. The ServerName must be a hostname.
You must set ServerName transprintusa.com, then use the Location or Directory directive to enable passenger when the request matches given location.
See Deploying to a sub URI from the Passenger documentation.