Apache + Passenger Rails app failing with a 403 error - ruby-on-rails

I currently have a rails app that works locally but at the moment of deploying the app i'm having an error configuring the server.
I followed the steps here, and i'm stuck on step 6. Instead of seeing the rails webpage i got
Inside /etc/apache2/sites-available/tesis.conf i got
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/tesis/public
RailsEnv development
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/html/tesis/public">
Options -MultiViews
Require all granted
Allow from all
</Directory>
And the rails app is located at /var/www/html/tesis/public, so that makes sense, but the odd thing is that debugging the apache error logs (/etc/apache2/sites-available/tesis.conf) i see:
[client 143.244.50.172:44448] AH01630: client denied by server configuration: /home/deploy/tesis/public/config
Why apache is going to that path instead of the one i specify on the configuration file?

Related

Redmine in Apache shows Blank Page

I've just tried to configure Redmine on my Apache server, as folows:
Files in /var/www/redmine.my.domain
In /etc/apache2/sites-available/redmine.my.domain.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName redmine.my.domain
ServerAdmin webmaster#localhost
DocumentRoot /var/www/redmine.my.domain/public/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
<Directory /var/www/redmine.my.domain/public>
Options Indexes ExecCGI FollowSymLinks
Order allow,deny
Allow from all
AllowOverride all
Options Indexes FollowSymLinks MultiViews
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
It only shows a blank page. Does anyone know what may be missing?
Redmine is RoR (Ruby on Rails) application, for usage and installation, official wiki should be followed since there are multiple steps and ways to run it on different platforms. Cick here and find the best way for your case.
In order to run it via Apache you must either run it as CGI/FCGI which is not very common way.
Or to run it via PhusionPassenger Apache module or PhusionPassenger standalone.
One common way to run it is via some Ruby app server like Puma, Unicorn, Webrick or Thin, then Apache or Ngnix reverse proxy it.
As stated earlier, various methods to run it, depending upon platform are described in official wiki.

zend framework skeleton application not showing properly

I have installed the Skeleton Application manually. My application is kept in "D:\xampp\htdocs\zf2". I've created a virtual host in the following way, in httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "D:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
ServerName zf2
DocumentRoot "D:/xampp/htdocs/zf2/public/index.php"
<Directory "D:/xampp/htdocs/zf2/public/index.php">
#DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
but it does not shown properly and it gives the output
and the remain ing application with module and database shows also not shows in the proper way
but if i slightly modify in virtual host settings of
DocumentRoot "D:/xampp/htdocs/zf2/public/index.php"
to
DocumentRoot "D:/xampp/htdocs/zf2/public"
then, skeleton application shows fine but when i configure module and database it gives error "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script. zend sleleton application error"
can any one help me i have waste lot of time to set it but didn't.
You need to set document root to the folder not a file. The page looks messed up when pointing to index.php as documentroot because it cannot find the stylesheets.
The issue with configuring the module/database is probably a different issue, and you would have to post your module/database configuration to get help there.

confused about apache server virtual host

So I configured a VirtualHost in the httpd-vhosts.conf directory, but whenever I navigate to the servername, it seems to always give me the page listed in httpd.conf.
I am new to apache web server and am not sure what else I need to do.
In my httpd-vhosts.conf I have
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerName helloworld.com
DocumentRoot /Users/username/Desktop/RailsDemo/depot/public/
<Directory /Users/username/Desktop/RailsDemo/depot/public/>
AllowOverride all
Options -MultiViews
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
In my httpd.conf, I have default settings, so I didn't change anything since install.
Also, I have matched helloworld.com to the correct ip address. Typing helloworld.com into the browser produces the wrong view...it produces the view indicated in httpd.conf.
If this helps, I am trying to do p. 238 of Pragmatic Agile Web Development with Ruby on Rails (4th Edition) -- Iteration K1: Deploying with Phusion Passenger and MySQL
Any help would be appreciated, thanks!
You seem to be running Mac OS X. In your httpd.conf, you will have the lines;
# Virtual hosts
#Include /private/etc/apache2/extra/httpd-vhosts.conf
Remove the comment, making it
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf
Restart apache, and that should activate your named vhost.

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

Location of web app on my server and Apache

I'm having a rough time with Apache and my Rails app on my production server. I have everything installed, libraries, gems, the whole get down. The issue is that I get a "Forbidden" error in my browser. I've even chmod'd my app directory with "777" but still no luck.
So my questions are:
What is your ServerName Directive (in your virtual host configuration)?
Where is your application located on your server?
Who owns your application directory?
What user should own your application directory?
Assuming your Apache has the Passenger (aka mod_rails) module installed and enabled, configuring a new Rails app is as simple as
<VirtualHost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin webmaster#example.com
ServerName example.com
ServerAlias www.example.com
# Index file and Document Root (where the public files are located)
# DirectoryIndex index.html
DocumentRoot /path/to/app/public
# Custom log file locations
ErrorLog /path/to/log/example.com/error.log
CustomLog /path/to/log/example.com/access.log combined
</VirtualHost>
Some important notes:
the default environment is "production"
be sure your DocumentRoot points to the /public folder of your app, not to the app root

Resources