ruby - 403 Forbidden on Rails app w/ Nginx, Passenger, unix -
hi having 403 error despite following steps here
403 forbidden on rails app w/ nginx, passenger
my app folder permissions
namei -l /home/ubuntu/resume_consumer/current/public f: /home/ubuntu/resume_consumer/current/public drwxr-xr-x root root / drwxr-xr-x root root home drwxr-xr-x ubuntu ubuntu ubuntu drwxrwxr-x ubuntu ubuntu resume_consumer lrwxrwxrwx ubuntu ubuntu current -> /home/ubuntu/resume_consumer/releases/20150815211156 drwxr-xr-x root root / drwxr-xr-x root root home drwxr-xr-x ubuntu ubuntu ubuntu drwxrwxr-x ubuntu ubuntu resume_consumer drwxrwxr-x ubuntu ubuntu releases drwxrwxr-x ubuntu ubuntu 20150815211156 drwxrwxr-x ubuntu ubuntu public
the nginx app running nobody
ps waux | grep nginx root 12005 0.0 0.0 42480 900 ? ss jul28 0:00 nginx: master process /opt/nginx/sbin/nginx nobody 12006 0.0 0.1 42804 2016 ? s jul28 0:00 nginx: worker process
my nginx config looks follows
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; pid logs/nginx.pid; events { worker_connections 1024; } http { passenger_root /home/ubuntu/.rvm/gems/ruby-2.2.1/gems/passenger-5.0.14; passenger_ruby /home/ubuntu/.rvm/wrappers/ruby-2.2.1/ruby; include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name qa.enterprise.getmeed.com; root /home/ubuntu/resume/current/public; passenger_enabled on; #charset koi8-r; #access_log logs/host.access.log main; # location / { # root html; # index index.html index.htm; #} #error_page 404 /404.html; # redirect server error pages static page /50x.html # #error_page 500 502 503 504 /50x.html; #location = /50x.html { # root html; #} # proxy php scripts apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} } # virtual host using mix of ip-, name-, , port-based configuration # server { listen 80; server_name qa.getmeed.com; root /home/ubuntu/resume_consumer/current/public; index index.html index.htm; passenger_enabled on; rails_env production; passenger_friendly_error_pages on; # location / { # root html; # index index.html index.htm; # } } # https server # #server { # listen 443; # server_name localhost; # ssl on; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_timeout 5m; # ssl_protocols sslv2 sslv3 tlsv1; # ssl_ciphers high:!anull:!md5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }
when @ logs, find alert says passengeragent not found error directory forbidden. not sure if alert related.
2015/08/15 23:40:41 [notice] 20858#0: signal process started 2015/08/15 23:40:41 [alert] 12005#0: unable start phusion passenger: support binary passengeragent not found (tried: /home/ubuntu/.rvm/gems/ruby-2.2.1/gems/passenger-5.0.14/buildout/support-binaries/passengeragent , /root/.passenger/support-binaries/5.0.14/passengeragent). means phusion passenger installation broken or incomplete, or 'passenger_root' setting contains wrong value. please reinstall phusion passenger or adjust setting (see: https://www.phusionpassenger.com/documentation/users%20guide%20nginx.html#passengerroot). (-1: unknown error) 2015/08/15 23:45:04 [error] 20859#0: *375 directory index of "/home/ubuntu/resume_consumer/current/public/" forbidden, client: 104.135.15.7, server: qa.getmeed.com, request: "get / http/1.1", host: "qa.getmeed.com"
you need see if can read file inside /home/ubuntu/resume_consumer/current/public
. showing permissions set in home directory of ubuntu, current
, public
have own permissions well.
first assuming there index.html inside of public, following return error:
sudo -u nobody /home/ubuntu/resume_consumer/current/public
if have permission problem. resolve adding nobody
user same ubuntu
group:
sudo adduser nobody ubuntu
and ensure group ubuntu
users have same access ubuntu
user.
sudo chmod -r g=u /home/ubuntu/resume_consumer
Comments
Post a Comment