简体   繁体   中英

Deploying with passenger - server answers 403 Forbidden or (over HTTPS) serves the directory index

I have some issues deploying my first rails application called "PoolShifts". My server is at home and has only one domain by no-ip.org . So I set up all the different servers (like owncloud, phpmyadmin...) in "subdirectories" aliased to the correct location. My server runs Debian 7 with Apache 2.2.22. I've passenger 4.0.8 installed and the mod files passenger.conf set to:

<IfModule mod_passenger.c>
  PassengerRoot /usr/local/rvm/gems/ruby-2.1.2/gems/passenger-4.0.8
  #PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-2.1.2/ruby
  PassengerDefaultRuby /usr/local/rvm/rubies/ruby-2.1.2/bin/ruby
</IfModule>

and passenger.load set to:

LoadModule passenger_module /usr/local/rvm/gems/ruby-1.1.2/gems/passenger-4.0.8/buildout/apache2/mod_passenger.so

Just as the passenger installation recommended. The apache2 modification was enabled by a2enmod passenger . The commented out part was given by the installation but 403 Forbidden on Rails app recommented to set it to the result of which ruby so I tried this, no success. My user is called "matze" and I've copied my application to /home/matze/PoolShifts . The site is enabled and the file /etc/apache2/sites-available/poolshifts contains:

Alias /poolshifts "/home/matze/PoolShifts/public/"
<VirtualHost *:80>
  ServerName localhost
  RailsEnv development
  DocumentRoot /home/matze/PoolShifts/public/
  <Directory /home/matze/PoolShifts/public>
    AllowOverride all
    Options -MultiViews
    Require all granted
    Options FollowSymLinks
    Order allow,deny
    Allow from all
    Options +Includes -Indexes
  </Directory>
</VirtualHost>

<VirtualHost *:443>
  ServerName localhost
  RailsEnv development
  DocumentRoot /home/matze/PoolShifts/public/

  <Directory /home/matze/PoolShifts/public>
    AllowOverride all
    Options -MultiViews
    Require all granted
    Options FollowSymLinks
    Order allow,deny
    Allow from all
    Options +Includes -Indexes
  </Directory>

  SSLEngine on
  SSLCertificateFile /root/server.crt
  SSLCertificateKeyFile /root/server.key
</VirtualHost>

All the other virtual hosts work just fine (with and without SSL encryption) but if I ask for /poolshifts over HTTP I get the 403 Forbidden error and the directory index of /home/matze/PoolShifts/public over HTTPS. Im just frustrated because I've been searching and trying all the different solutions I found for several days now. It seems like there is no passenger instance running because passenger-status gives me:

Version : 4.0.8
Date    : 2015-08-12 16:52:14 +0200
Instance: 26551
----------- General information -----------
Max pool size : 6
Processes     : 0
Requests in top-level queue : 0

----------- Application groups -----------

I can start the application server WebRick and the application works just fine. Do you maybe know what I'm doing wrong here?

After two weeks I found a way to get it to work. To alias the rails server was not excepted by passenger. The solution was to use the full domain as the server name and switch every other server to an Alias. I don't know why it worked, but it did!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM