我已經安裝了所需的工具,並遵循了幾個試圖讓乘客迴應的教程。我得到403錯誤使用乘客在阿帕奇導軌
我可以訪問公用文件夾(public/500.html或422.hml)中的靜態文件。昨天我通過虛幻進入,發現一些乘客錯誤。但一段時間後,託管服務重新啓動,從那以後,我一直無法再訪問rails應用程序。
這些都是我用來配置服務器的鏈接。我也讀過這可能是一個權限問題;我檢查過,但我不確定它是否正常。
我已經安裝了所需的工具,並遵循了幾個試圖讓乘客迴應的教程。我得到403錯誤使用乘客在阿帕奇導軌
我可以訪問公用文件夾(public/500.html或422.hml)中的靜態文件。昨天我通過虛幻進入,發現一些乘客錯誤。但一段時間後,託管服務重新啓動,從那以後,我一直無法再訪問rails應用程序。
這些都是我用來配置服務器的鏈接。我也讀過這可能是一個權限問題;我檢查過,但我不確定它是否正常。
答案是乘客給了我403,因爲我必須在Apache配置上設置環境變量「RackEnv」爲「開發」(在我的情況下)。
首先檢查你的錯誤日誌。默認情況下,它位於/var/log/apache2/
。
如果您有client denied by server configuration
問題,請檢查您的站點conf文件/etc/apache2/sites-available/your-site.conf
。它必須符合Phusion Passenger User Guide。看看Require all granted
。
<Directory "/home/user/folder">
Require all granted
Options FollowSymLinks
# This relaxes Apache security settings.
AllowOverride None
# MultiViews must be turned off.
Order allow,deny
Allow from all
</Directory>
謝謝! '要求所有授予'使它工作 – macool
似乎'要求所有授予'是必需的*如果您使用的Apache> = 2.4 – rogerdpack
在我的Mac OS 10.9(類Unix系統)上,我也在apache上使用passenger for rails導致了403錯誤。 下面是一些提示:
問題:權限被拒絕:訪問/拒絕(文件系統路徑'path_apache_access'),因爲路徑的組件上缺少搜索權限。
通過CLI檢查'path_apache_access':ls -ld'path_apache_access'並使用chmod + x更改路徑特權。請注意:Httpd Wiki - (13) Permission Denied-。
問題:配置錯誤:無法執行身份驗證。 AuthType未設置!。
問題:客戶端被服務器配置拒絕。
轉到/etc/apache2/httpd.conf並看看<目錄>標記。
檢查Apache的版本,通過CLI命令:的apachectl -v,如果Apache < 2.4,不取消註釋 「要求所有授權」。
<Directory "rails_app_directory/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
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
確定這對我來說意味着我的運轉軌道2.3和使用Phusion客運5.x的
顯然5.x中不與2.2在所有的工作,並要求2.3爲你複製一個config.ru文件,以便它爲後端使用機架。
2.3例如config.ru文件:
# Rack Dispatcher
# Require your environment file to bootstrap Rails
require File.dirname(__FILE__) + '/config/environment'
# Dispatch the request
run ActionController::Dispatcher.new
我無法弄清楚,爲什麼沒有咒語似乎工作,就好像乘客無視我的Rails應用程序。
在我/var/log/apache2/error.log文件,我有這樣的:
[Mon May 11 15:47:00.397891 2015] [autoindex:error] [pid 17490:tid 3058694976] [client 216.49.181.251:49248] AH01276: Cannot serve directory /home/x/y/railsapp/public/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive, referer: https://www.google.com/
這混淆了赫克了我的意思顯然是「乘客不是虛擬主機上運行」 。
如果我創建了一個public/index.html文件,Apache服務很好,所以它不是一個權限問題。
我也看到了這一點,這意味着乘客被確定啓動:
[ 2015-05-11 18:23:53.9594 4964/b7415700 agents/Watchdog/Main.cpp:728 ]: All Phusion Passenger agents started!
所以基本上與乘客5.x的(在發行說明它說,軌2.2 ISN」 t支持,2.3只支持如果你創建一個「config.ru」文件在你的rails應用程序的根目錄。它適用於舊版本的機架,如導軌2.3要求,只需刪除你的新機架寶石,並安裝1.1.6或者什麼都不要,如果有的話刪除已售出的機架寶石。GL!
另外,作爲一個側面說明,這條消息:
[Mon May 11 18:25:10.235574 2015] [core:alert] [pid 5263:tid 3017780032] [client 127.0.0.1:56737] /home/rdp/dev/prod_flds/public/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
的意思是「刪除您的公共/ .htaccess文件它不是由乘客通常需要」
很好的解釋,什麼會進入config.ru文件? –
@SurgePedroza增加了我的外觀,FWIW。 – rogerdpack
403禁止錯誤是權限問題。檢查文檔根目錄並確保index.php具有644權限。還要確保index.php的用戶所有權與500.html中的用戶所有權相同。 –
這是一個Rails應用程序,通過Apache +乘客工作。我可以訪問本地文件,如圖像。但是,當鐵軌應該響應,給我那個錯誤。 – narc88