【问题标题】:uWSGI + Nginx (Permission denied) + CentOSuWSGI + Nginx(权限被拒绝)+ CentOS
【发布时间】:2020-02-08 00:56:12
【问题描述】:

我正在尝试使用 uwsgi 和 nginx 服务器安装烧瓶应用程序。每次我运行我的服务时,我都会收到权限被拒绝错误。

/home/zerotouch/zerotouch/zerotouch.ini

[uwsgi]
module = wsgi

master = true
processes = 5

uid=nginx
gid=nginx
socket = /run/uwsgi/zerotouch.sock
chown-socket = zerotouch:nginx
chmod-socket = 660
vacuum = true

die-on-term = true

/etc/systemd/system/zerotouch.service

[Unit]
Description=uWSGI instance to serve zerotouch
After=network.target

[Service]
User=zerotouch
Group=nginx

WorkingDirectory=/home/zerotouch/zerotouch

Environment="PATH=/home/zerotouch/zerotouch/env/bin"

ExecStartPre=-/usr/bin/bash -c 'mkdir -p /run/uwsgi; chown zerotouch:nginx /run/uwsgi; chown zerotouch:nginx /home/zerotouch/zerotouch/env/bin/activate;'

ExecStart=/usr/bin/bash -c 'source /home/zerotouch/zerotouch/env/bin/activate;/home/zerotouch/zerotouch/env/bin/uwsgi --ini /home/zerotouch/zerotouch/zerotouch.ini'

[Install]
WantedBy=multi-user.target

错误

 systemctl status zerotouch
● zerotouch.service - uWSGI instance to serve zerotouch
   Loaded: loaded (/etc/systemd/system/zerotouch.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2019-10-10 16:34:35 CEST; 8s ago
  Process: 28843 ExecStart=/usr/bin/bash -c source /home/zerotouch/zerotouch/env/bin/activate;/home/zerotouch/zerotouch/env/bin/uwsgi --ini /home/zerotouch/zerotouch/zerotouch.ini (code=exited, status=1/FAILURE)
  Process: 28839 ExecStartPre=/usr/bin/bash -c mkdir -p /run/uwsgi; chown zerotouch:nginx /run/uwsgi; chown zerotouch:nginx /home/zerotouch/zerotouch/env/bin/activate; (code=exited, status=127)
 Main PID: 28843 (code=exited, status=1/FAILURE)

Oct 10 16:34:35 aj-poc-1 bash[28843]: detected binary path: /home/zerotouch/zerotouch/env/bin/uwsgi
Oct 10 16:34:35 aj-poc-1 bash[28843]: your processes number limit is 7259
Oct 10 16:34:35 aj-poc-1 bash[28843]: your memory page size is 4096 bytes
Oct 10 16:34:35 aj-poc-1 bash[28843]: detected max file descriptor number: 1024
Oct 10 16:34:35 aj-poc-1 bash[28843]: lock engine: pthread robust mutexes
Oct 10 16:34:35 aj-poc-1 bash[28843]: thunder lock: disabled (you can enable it with --thunder-lock)
Oct 10 16:34:35 faj-poc-1 bash[28843]: bind(): Permission denied [core/socket.c line 230]
Oct 10 16:34:35 aj-poc-1 systemd[1]: zerotouch.service: main process exited, code=exited, status=1/FAILURE
Oct 10 16:34:35 aj-poc-1 systemd[1]: Unit zerotouch.service entered failed state.
Oct 10 16:34:35 aj-poc-1 systemd[1]: zerotouch.service failed.

【问题讨论】:

    标签: nginx centos7 uwsgi


    【解决方案1】:

    创建和编辑套接字的权限存在问题。

    所以我去了 /run/uwsgi 并使用ls -lhtr 来获取文件权限的概述

    然后我使用vi zerotouch.sock创建了一个空白的sock文件zerotouch.sock

    并为此文件添加了 user:zerotouch 和 group:nginx 的权限

     chown zerotouch:nginx -R /run/uwsgi
    

    【讨论】:

      猜你喜欢
      • 2020-08-25
      • 2017-07-23
      • 1970-01-01
      • 2014-03-31
      • 1970-01-01
      • 2021-04-02
      • 2016-02-02
      • 2016-05-02
      • 1970-01-01
      相关资源
      最近更新 更多