简体   繁体   English

与乘客一起部署-服务器回答403禁止或(通过HTTPS)提供目录索引

[英]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". 我在部署第一个Rails应用程序“ PoolShifts”时遇到一些问题。 My server is at home and has only one domain by no-ip.org . 我的服务器在家里, no-ip.org仅具有一个域。 So I set up all the different servers (like owncloud, phpmyadmin...) in "subdirectories" aliased to the correct location. 因此,我在别名正确位置的“子目录”中设置了所有不同的服务器(如owncloud,phpmyadmin ...)。 My server runs Debian 7 with Apache 2.2.22. 我的服务器在Apache 2.2.22上运行Debian 7。 I've passenger 4.0.8 installed and the mod files passenger.conf set to: 我已经安装了Passenger 4.0.8,并将mod文件passenger.conf设置为:

<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: 和passenger.load设置为:

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 . apache2修改由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. 注释掉的部分是由安装提供的,但是403 Forbidden on Rails应用建议将其设置为使用which ruby的结果,因此我尝试了此操作,但没有成功。 My user is called "matze" and I've copied my application to /home/matze/PoolShifts . 我的用户称为“ matze”,我已将我的应用程序复制到/home/matze/PoolShifts The site is enabled and the file /etc/apache2/sites-available/poolshifts contains: 该站点已启用,文件/etc/apache2/sites-available/poolshifts包含:

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. 所有其他虚拟主机都可以正常工作(使用SSL加密和不使用SSL加密),但是如果我通过HTTP请求/poolshifts通过HTTPS收到403 Forbidden错误和/home/matze/PoolShifts/public的目录索引。 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: 似乎没有任何乘客实例在运行,因为passenger-status给了我:

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. 我可以启动应用程序服务器WebRick,并且应用程序运行正常。 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. 别名并非所有旅客都将Rails服务器排除在外。 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! 我不知道它为什么起作用,但是它起作用了!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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