我想在nginx上的unicorn上设置rails。 设置unicorn和nginx并像下面的代码一样修改nginx.conf。 但是,在rails的主视图中,rails-default-image未显示为附加图片。请帮忙!!
版本;
ruby:2.4.0 p0,
轨道:5.0.2,
nginx:1.10.2
* Nginx位于amazon linux AMI
Follwing代码是nginx.conf
user ec2-user;
worker_processes 1
events {
worker_connections 1024;
}
http {
# sendfile on;
# tcp_nopush on;
# tcp_nodelay on;
# keepalive_timeout 65;
# types_hash_max_size 2048;
upstream unicorn {
server unix:/myPathTo/tmp/unicorn.sock;
}
server {
listen my-port;
server_name my-server;
access_log /var/log/access.log;
error_log /var/log/error.log;
root my-root
# index index.html;
client_max_body_size 4G; #100m;
error_page 404 /404.html;
error_page 500 502 503 504 /500.html;
try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://unicorn;
}
}
}
以下内容为error.log
2017/04/23 06:45:40 [crit] 29912#0: *1 open()
"/var/lib/nginx/tmp/proxy/1/00/0000000001" failed (13: Permission
denied) while reading upstream, client: (clientserver), server:
(my-server), request: "GET / HTTP/1.1", upstream:
"http://unix:/pathTo/tmp/unicorn.sock:/", host:
"(my-server)"
显示rails的默认视图: enter image description here