После развертывания приложения rails я получаю ошибку 404 not found. Я использую: ubuntu, nginx, capistrano и unicorn.
Это мои конфигурации:
nginx.conf
upstream unicorn {
server unix:/tmp/unicorn.mysite.sock fail_timeout=0;
}
server {
server_name dima;
return 301 $scheme://mysite$request_uri;
}
server {
listen 80 default deferred;
server_name dima;
root /var/www/mysite/current/public;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn;
}
error_page 500 502 503 504 /500.html;
keepalive_timeout 10;
}
unicorn.rb
root = "/var/www/mysite"
working_directory root
pid "#{root}/tmp/pids/unicorn.pid"
stderr_path "#{root}/log/unicorn.log"
stdout_path "#{root}/log/unicorn.log"
worker_processes Integer(ENV['WEB_CONCURRENCY'])
timeout 30
preload_app true
listen '/tmp/unicorn.spui.sock', backlog: 64
unicorn_init.sh
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/var/www/mysite
PID=$APP_ROOT/tmp/pids/unicorn.pid
CMD="cd $APP_ROOT; ~/.rbenv/bin/rbenv exec bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E production"
AS_USER=dima
set -u
& на сервере / и т.д. / nginx / сайты-доступные / по умолчанию
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name mysite;
#passenger_enabled on;
#rails_env production;
root /var/www/mysite/public;
error_page 500 502 503 504 /50x.html;
location = /50.x.html {
root html;
}
}
Вот отрывок из error.log
2015/05/08 15:33:12 [error] 3383#0: *28 "/var/www/mysite/public/index.html" is not found (2: No such file or directory), client:*.*.*.*, server: mysite, request: "GET / HTTP/1.1$
Когда я прошу /current/public/
вместо просто /public/
, Мне запрещается 403. И журнал:
3 directory index of "/var/www/mysite/current/public/" is forbidden, client: *..*.*, server: mysite, request: "GET / HTTP/1.1"` –