小编Bri*_*ach的帖子

nginx 失败 (13: Permission denied) uwsgi (502 bad gateway)

我在新的 DigitalOcean Droplet 上运行我的应用程序时遇到问题。本机运行 CentOS 6.5

我的 /etc/nginx/nginx.conf

user  nginx www-data;
worker_processes  1;

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

pid        /var/run/nginx.pid;
(continues)
Run Code Online (Sandbox Code Playgroud)

我的 myapp_nginx.conf

server {

   server_name 104.xxx.x.xxx;
    listen      8080;
    charset     utf-8;
    client_max_body_size 30M;

    location / {
        index index.html index.htm;
        root /home/webdev/mydevelopment/git/ers_portal;
        try_files $uri @app;
    }

    location /static {
    alias /home/webdev/mydevelopment/git/ers_portal/app/static;
    }

    location @app {
        include uwsgi_params;
        uwsgi_pass unix:/home/webdev/mydevelopment/git/ers_portal_uwsgi.sock;
    }
}
Run Code Online (Sandbox Code Playgroud)

我的 myapp_uwsgi.ini

[uwsgi]
master = true
#user info
uid = webdev
gid = www-data

#application's base folder …
Run Code Online (Sandbox Code Playgroud)

permissions nginx centos uwsgi

5
推荐指数
1
解决办法
2万
查看次数

使用 supervisord 运行(和监控)nginx

我将从我的用例开始,因为我很可能没有使用正确的工具来完成这项工作。如果我以错误的方式处理这件事,请告诉我

用例:我有一个 CentOS 服务器托管多个 Web 应用程序。我希望能够相信我的 Web 服务器和应用程序服务器将运行。我的堆栈看起来像

  • 网络服务器:nginx
  • 应用服务器:uWSGI
  • 网络框架:flask / python

我想用supervisord来监控nginx和uWSGI。在我的 /etc/supervisor.conf 中,我有

[program:nginxgo]
command = /usr/sbin/nginx
autostart=true
autorestart=unexpected
exitcodes=0
stdout_logfile=/home/webdev/nginxgo.log
stderr_logfile=/home/webdev/nginxgoerr.log

[program:uwsgi_emperor_go]
command = uwsgi --emperor /etc/uwsgi/emperor.ini
autostart=true
autorestart=unexpected
stopsignal=INT
stdout_logfile=/home/webdev/emp.log
stderr_logfile=/home/webdev/emperr.log
directory=/home/webdev/
user=webdev
Run Code Online (Sandbox Code Playgroud)

我启动了 uWSGI 进程。当我进入[root@mymachine]# /usr/local/bin/supervisord -n -c /etc/supervisord.conf

输出是

2014-11-26 14:07:56,917 CRIT Supervisor running as root (no user in config file)
2014-11-26 14:07:56,951 CRIT Server 'inet_http_server' running without any HTTP authentication checking
2014-11-26 14:07:56,952 INFO supervisord started with pid 31068
2014-11-26 14:07:57,957 …
Run Code Online (Sandbox Code Playgroud)

nginx centos uwsgi supervisord

5
推荐指数
1
解决办法
8202
查看次数

标签 统计

centos ×2

nginx ×2

uwsgi ×2

permissions ×1

supervisord ×1