I want set up rails on unicorn on nginx. Setup unicorn and nginx and modify nginx.conf like following code. However, on the home view of rails, rails-default-image is not shown as the attached picture. Please help!!
Versions;
ruby:2.4.0 p0,
rails:5.0.2,
nginx: 1.10.2
*Nginx is located on amazon linux AMI
Follwing code is 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;
}
}
}
Following content is 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)"
Shown default view of rails: enter image description here
"/var/lib/nginx/tmp/proxy/1/00/0000000001" failed (13: Permission denied)
. The user that is running the server is not allowed to read from thetmp
folder. – Gadidchmod
. Thank you very much. But in this time, I usechmod 777 nginx
. What authority you recommend? – Wampler