Nginx乘客config.ru访问

时间:2019-03-12 00:09:09

标签: ruby-on-rails nginx passenger

我知道我们不应该提出重复要求,但是我已经搜索并发现了一些半重复要求,但是没有什么可以解决的-ergo这是一个问题

我正在使用centos / passenger / nginx托管我的rails应用程序。这是我在此服务器上的第一个部署(之前已经部署了其他应用程序)。

我正在通过capistrano部署到 / home / wms / towson /当前文件夹

这是我的nginx.conf

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user wms wms;
worker_processes  1;

error_log  /var/log/nginx/error.log info;
#error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;

pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {

    include       /etc/nginx/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  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;

    keepalive_timeout  65;

    server_tokens off;

    gzip  on;


    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.

    include /etc/nginx/conf.d/*.conf;


    ####server {

        #charset koi8-r;

        ####access_log  /var/log/nginx/host.access.log  main;

        # Load configuration files for the default server block.
        ####include /etc/nginx/default.d/*.conf;

        #location / {
         #}


        # redirect server error pages to the static page /40x.html
        #
        ####error_page  404              /404.html;
        ####location = /40x.html {
        ####}

        # redirect server error pages to the static page /50x.html
        #
        ####error_page   500 502 503 504  /50x.html;
        ####location = /50x.html {
        ####}
    ####}

    server {
        listen 8080;
    access_log /var/log/nginx/host.access.log main;
        server_name <site name>;

        # Tell Nginx and Passenger where your app's 'public' directory is
        root /home/wms/towson/current/public;

        # Turn on Passenger
        passenger_enabled on;
        passenger_ruby /home/wms/.rvm/gems/ruby-2.4.0/wrappers/ruby;
        passenger_app_env production;
    passenger_user wms;
    passenger_group wms;
    }


}

这是我目录的权限-自从我在线阅读以来,我们已经放宽了所有父目录的权限

/ home / wms

drwxrwxrwx. 16 wms  wms   4096 Mar 11 18:56 wms

/ home / wms / towson

drwxrwxrwx.  5 wms  wms      4096 Mar 11 18:17 towson

/ home / wms / towson / current

lrwxrwxrwx.  1 wms wms   40 Mar 11 18:17 current -> /home/wms/towson/releases/20190311231702

最后是/ home / wms / towson / current /

内容的权限
drwxr-xr-x. 14 wms wms 4096 Mar 11 18:17 .
drwxr-xr-x.  7 wms wms 4096 Mar 11 18:18 ..
drwxr-xr-x. 11 wms wms 4096 Mar 11 18:16 app
drwxr-xr-x.  2 wms wms 4096 Mar 11 18:17 assets_manifest_backup
drwxr-xr-x.  2 wms wms 4096 Mar 11 18:16 bin
drwxr-xr-x.  2 wms wms 4096 Mar 11 18:17 .bundle
-rw-r--r--.  1 wms wms 1092 Mar 11 18:16 Capfile
drwxr-xr-x.  6 wms wms 4096 Mar 11 18:16 config
**-rwxrwxrwx.  1 wms wms  130 Mar 11 18:16 config.ru**
drwxr-xr-x.  3 wms wms 4096 Mar 11 18:16 db
-rw-r--r--.  1 wms wms  927 Mar 11 18:16 .DS_Store.gz
-rw-r--r--.  1 wms wms 1323 Mar 11 18:16 Gemfile
-rw-r--r--.  1 wms wms 7970 Mar 11 18:16 Gemfile.lock
-rw-r--r--.  1 wms wms  647 Mar 11 18:16 .gitignore
drwxr-xr-x.  5 wms wms 4096 Mar 11 18:16 lib
lrwxrwxrwx.  1 wms wms   27 Mar 11 18:17 log -> /home/wms/towson/shared/log
-rw-r--r--.  1 wms wms   64 Mar 11 18:16 package.json
drwxr-xr-x.  3 wms wms 4096 Mar 11 18:17 public
-rw-r--r--.  1 wms wms  227 Mar 11 18:16 Rakefile
-rw-r--r--.  1 wms wms  374 Mar 11 18:16 README.md
-rw-r--r--.  1 wms wms   41 Mar 11 18:17 REVISION
-rw-r--r--.  1 wms wms   10 Mar 11 18:16 .ruby-version
drwxr-xr-x.  2 wms wms 4096 Mar 11 18:16 storage
drwxr-xr-x.  9 wms wms 4096 Mar 11 18:16 test
drwxr-xr-x.  2 wms wms 4096 Mar 11 18:17 tmp
drwxr-xr-x.  2 wms wms 4096 Mar 11 18:16 vendor

我已将大多数文件/目录设为777或r + execute权限,但是每次我与乘客运行nginx时-我一直在获得

2019/03/11 18:52:56 [alert] 20412#0: *1 Cannot stat **'/home/wms/towson/current/config.ru': Permission denied (errno=13); This error means that the Nginx worker process (PID 20412, running as UID 500) does not have permission to access this file. Please read this page to learn how to fix this problem:** https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/?a=upon-accessing-the-web-app-nginx-reports-a-permission-denied-error; Extra info, client: 69.120.77.155, server: wms.cloudmatrix.net, request: "GET / HTTP/1.1", host: "wms.cloudmatrix.net:8080"

我不知道下一步该怎么做。它必须是简单明了的东西-但我完全想念它。

这是nginx和Passenger的ps-ef命令的输出

root     20404     1  0 18:52 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf

wms 20412 20404 0 18:52吗? 00:00:00 nginx:工作进程

它以wms用户身份运行。

对于乘客-

    root     20382     1  0 18:52 ?        00:00:00 Passenger watchdog                                                      
root     20385 20382  0 18:52 ?        00:00:00 Passenger core 

此文件以root用户身份运行,但是我的所有文件都是世界可读的

有人对我做错了什么以及为什么我不断收到“权限被拒绝”问题有任何想法。

我还在服务器上的wms用户下安装了乘客gem和rvm。

任何帮助都会很棒。我为此几乎浪费了一天。

谢谢

0 个答案:

没有答案