簡體   English   中英

403 Forbidden〜Nginx在Bluemix上

[英]403 Forbidden ~ nginx on Bluemix

這是我昨天在SO上發布的問題的延續。 我不確定是否應該提出其他問題,或者只是將其鏈接到舊帖子。

一直以來,我一直在嘗試將Rails應用程序上的ruby部署到Bluemix上。 經過反復的嘗試,我終於設法推動了應用程序並啟動了它。 但是,當我嘗試打開W​​eb應用程序時。 Bluemix拋出一個錯誤

403 Forbidden
   nginx 

如果我理解正確,則與訪問RoR應用程序中的某些文件夾的權限有關。 如何解決這個問題。 在將其推送到bluemix之前,我是否必須更改對本地應用程序的許可?或者在bluemix上需要做些什么?

這是鏈接

編輯:

這是我在bluemix上的ngnix文件夾上的錯誤日志

2015/07/23 10:16:39 [error] 37#0: *2 directory index of "/home/vcap/app/public/" is forbidden, client: 75.126.52.20, server: localhost, request: "GET / HTTP/1.1", host: "csw-events.mybluemix.net"

Bluemix上的ngnix.conf文件

worker_processes 1;
daemon off;

error_log /home/vcap/app/nginx/logs/error.log;
events { worker_connections 1024; }

http {
  log_format cloudfoundry '$http_x_forwarded_for - $http_referer - [$time_local] "$request" $status $body_bytes_sent';
  access_log /home/vcap/app/nginx/logs/access.log cloudfoundry;
  default_type application/octet-stream;
  include mime.types;
  sendfile on;

  gzip on;
  gzip_disable "msie6";
  gzip_comp_level 6;
  gzip_min_length 1100;
  gzip_buffers 16 8k;
  gzip_proxied any;
  gzip_types text/plain text/css text/js text/xml text/javascript application/javascript application/x-javascript application/json application/xml application/xml+rss;

  tcp_nopush on;
  keepalive_timeout 30;
  port_in_redirect off; # Ensure that redirects don't include the internal container PORT - 61596
  server_tokens off;

  server {
    listen 61596;
    server_name localhost;

    location / {
      root /home/vcap/app/public;
      index index.html index.htm Default.htm;

    }
  }
}

ngix文件夾在我的本地系統上不存在。 它在我將應用程序推送到bluemix時創建(或者我在這里缺少什么嗎?)

您不能使用Nginx(靜態buildpack來提供Ruby on Rails應用程序。必須為此使用Ruby buildpack。

造成此問題的原因有兩個(在我的方案中至少是這樣)。

a)沒有使用正確的構建包。 解決我問題的一個方法是使用CF中的這個buildpack

cf push csw-events -b https://github.com/cloudfoundry/ruby-buildpack.git

b)清單文件的敏感性-Bluemix開始引發以下錯誤:

FAILED 
Error reading manifest file: 
yaml: [] control characters are not allowed at line 1, column 1

通過再次下載清單文件並僅替換其中的特定部分(如命令部分)來解決此問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM