Ruby + Passenger - Redmine deployment issue - ruby-on-rails

I am trying to deploy Redmine on my web server.
I have chose to use passenger to deploy the ruby app.
I have tested with the rake's demo app, but when I pointed my VitualHost to the red mine public folder I got this error:
Directory index forbidden by Options directive: /var/www/redmine/public/
Can anyone help?
Virtual host:
<VirtualHost *:80>
ServerName redmine.myserver.com
DocumentRoot /var/www/redmine/public
ErrorLog /var/www/redmine/redmine-error-log
<Directory var/www/redmine/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>

IMHO Passenger is missing some configuration in your example. Here is what I've in production :
<Directory /var/www/redmine>
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
</Directory>
Where /var/www/redmine was created as a symbolic link :
sudo ln -s /usr/share/redmine/public /var/www/redmine
You might also ensure that the rights are properly set on your redmine folder (the root one).

I have solved this issue.
The problem was caused by SElinux.
I had to enable the permissive mode.
setenforce 0
Then I have configured the Redmine app and set the correct permissions to the folders again.
In the end I have disabled the permissive mode:
setenforce 1

Related

Rails application isn't restarting after system reboot

I have a Rails 4 application deployed with Apache and Passenger.
The configuration was provided by this thread and everything worked perfectly.
I created a whenever job that runs when the machine restarts, and I rebooted the machine to check if it works, and it does.
BUT, from some reason my web address is no longer reachable. It seems like the machine doesn't route the requests to the application (I get "this webpage isn't available" message from the browser).
I've double checked the /etc/httpd/conf/httpd.conf file to make sure the configuration still exists and it does.
I also tried to push again the application to the machine using cap production deploy, and didn't get any errors while doing that.
My configuration in the /etc/httpd/conf/httpd.conf file is the following:
<VirtualHost *:80>
ServerName csi-eng-perf.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /var/www/eng_performance/current/public/
<Directory /var/www/eng_performance/current/public/>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I have no idea what have gone wrong.
Well, as it turns out #Substantial suggestion was correct.
I wasn't able to issue the apachectl status command (needed the installation of another package called links) but the restart command did the trick- apachectl -k restart.

Rails 3 + passenger conf file

I have been trying to install a rails app on a box that originally was used for multiple php applications. I installed passenger and created a conf file but I am confused about how it all works together.
What should my ServerName be if i want to access a Rails app? The box is a debian squeeze running apache2 with passenger module installed. Below is my conf file. I currently have to go to xxx.xxx.xxx.xxx/leoadmin/public to get the application to run properly. I have the following htaccess in the public directory. Which I think is unnecessary if my conf file is configured correctly.
I think my main issue is the misconfiguration of the conf file. I believe the conf file is being loaded but i don't understand why i still need the htaccess for me to see any action.
.htaccess
#PassengerEnabled On
PassengerAppRoot /var/www/leoadmin/
#Options -MultiViews
#PassengerResolveSymlinksInDocumentRoot on
#Set this to whatever environment you'll be running in
RailsEnv production
#RackBaseURI /var/www/leoadmin
vhost config
<VirtualHost *>
ServerName leoadmin
DocumentRoot /var/www/leoadmin/public
<Directory /var/www/leoadmin/public>
Allow from all
</Directory>
Alias /leoadmin /var/www/leoadmin/public
<Location /leoadmin>
SetEnv RAILS_RELATIVE_URL_ROOT "/leoadmin"
PassengerAppRoot /var/www/leoadmin
</Location>
ErrorLog /var/log/apache2/leoadmin-error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/leoadmin-access.log combined
</VirtualHost>
I had nothing but pain and more pain trying to get this sorted a few months back, my configuration allows me to do sub URIs, so I'm not sure if that's what you want, but it'll be along these lines. I've never needed a .htaccess file for this setup:
NameVirtualHost *:80 <VirtualHost *:80>
ServerName www.test.co.uk
DocumentRoot /web/rails
<Directory /web/rails>
Allow from all
</Directory>
RailsBaseURI /test
RailsEnv development
<Directory /web/rails_projects/test/>
Options -MultiViews
</Directory>
For me /web/rails is a root directory, from there I have a number of symlinks to my /home/ directory where I store my projects. ServerName is whatever qualified name you're using for the machine that's going to be recognised.
(just in case, I'm running Passenger 3.0.9, and Rails 3.2.11)

Passenger on Ubuntu still only serving default index.html

Trying to get my server to serve my rails apps.
I have a test app installed, apache2 and passenger have been installed have I have added the following to the apache2.conf
# Include the virtual host configurations:
Include sites-enabled/
NameVirtualHost localhost:80
<VirtualHost localhost:80>
ServerName 192.168.1.67
DocumentRoot /home/john/Public/test-app
</VirtualHost>
Clearly, I am misunstanding something, because I think that should redirect calls to my local IP to my rails app. It is not. It is going to the default apache index.html.
What am I doing wrong?
UPDATED answer:
I think you are missing the "Directory" node. try using this config code:
(assuming your project path is: /home/john/Public/test-app)
<VirtualHost *:80>
DocumentRoot /home/john/Public/test-app/public
RailsEnv development
<Directory /home/john/Public/test-app/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
This is how I usually do it:
<VirtualHost *:80>
ServerName mysubdomain.betamaster.us
DocumentRoot /var/www_home/mysubdomain/
</VirtualHost>
After applying these changes make sure to execute
/etc/init.d/apache2 reload
in order to reload the server configuration.
I had the same symptoms in this question but it was a different problem. My apache install already had a Virtual host enabled, so I had to disable it and enable my own with the commands
sudo a2dissite default
sudo a2ensite myapp
where default was the name of the Virtual Host file included by default in sites-avaliable/ and myapp is the file i added.
Hopefully this helps someone.

Apache and passenger setup virtualhost restart failing

I have installed passenger on my Ubuntu 10.x server and I am running Apache2. I have followed the instruction "I think" pretty well. After setting up my virtual host and trying to restart I am getting a failed to start apache error because Documentroot takes one argument. I have the document root set is the thing so I am wondering if you guys could offer some suggestions as to what I may be doing wrong.
I have all my virtual hosts in separate files by domain name, so the directory structure on the server is something like this
/etc/apache2/sites-available/dev.mydomain.com
/etc/apache2/sites-enabled/dev.mydomain.com
both files have the following in them but restarting apache only fails when I put the vhost info in the enabled file.
<VirtualHost *:80>
ServerName dev.mydomain.com
DocumentRoot /home/myfolder/dev/vb/public # <-- be sure to point to 'public'!
<Directory /home/myfolder/dev/vb/public>
AllowOverride all # <-- relax Apache security settings
Options -MultiViews # <-- MultiViews must be turned off
</Directory>
</VirtualHost>
Thanks for any help you can offer.
Comments in httpd.conf must go on their own line.
have you given before defining VirtualHost
NameVirtualHost *:80
if this given remove those commented line after document root and try

Controller pages inaccessible in new RoR project...why?

I set up a new RoR project on MAC OS Leopard, created a repository, svn added the whole Rails project, committed, checked out at my site, set up a vhost (see below), and I cannot get to a new controller page I created (/mycontroller/index). I CAN get to the "Welcome Aboard" page. I have another Ruby install (Redmine project management software) running with Apache.
I get this:
Not Found
The requested URL /developer was not found on this server.
Apache/2.2.8 (Ubuntu) mod_fastcgi/2.4.6 PHP/5.2.4-2ubuntu5.3 with Suhosin-Patch mod_scgi/1.12 Server at colorubooks.chadjohnson.ath.cx Port 8080
Here is my vhost setting:
<VirtualHost *:80>
ServerName mysite.mydomain.ath.cx
ServerAdmin email#gmail.com
DocumentRoot /srv/www/mysite.mydomain.ath.cx/public
RailsEnv development
<Directory "/srv/www/mysite.mydomain.ath.cx/public">
Options Indexes ExecCGI FollowSymLinks -MultiViews
Order allow,deny
Allow from all
AllowOverride all
</Directory>
</VirtualHost>
First:
In DocumentRoot you missed a /
change:
DocumentRoot /srv/www/mysite.mydomain.ath.cxpublic
to:
DocumentRoot /srv/www/mysite.mydomain.ath.cx/public
then you should be able to see static files in the /public directory (like the welcome aboard page)
Now I have a question for you... I presume that you want to use apache to deploy... Have you already installed and setup passenger (mod_rack) apache module?
Link to easy passenger install guide: http://modrails.com/install.html
enjoy!

Resources