小编Nij*_*jo 的帖子

使用uwsgi + nginx暂时无法使用资源

我使用nignx-uwsgi的django app主机.这是我的uwsgi配置:

[uwsgi]
 master          = true 
 socket          = /var/uwsgi/uwsgi.sock
 chmod-socket    = 666
 chdir           = /home/ubuntu/test
 wsgi-file       = /home/ubuntu/test/test/wsgi.py
 virtualenv      = /home/ubuntu/virtual
 vacuum          = true
 enable-threads  = true
 daemonize= /home/ubuntu/uwsgi.log
Run Code Online (Sandbox Code Playgroud)

我在nignx日志中遇到错误

2017/06/16 04:25:42 [错误] 26129#0:*1141328 connect()到unix:///var/uwsgi/uwsgi.sock失败(11:资源暂时不可用)连接到上游,客户端: xxx.xxx.xx,服务器:

并且该站点显示502坏网关.我必须重新启动uwsgi来修复它.但是错误的频率正在增加.有没有什么办法解决这一问题.

django nginx uwsgi

8
推荐指数
1
解决办法
4426
查看次数

如何将 django 日志文件保存在 aws elastic beanstalk 中托管的 django 应用程序的 s3 存储桶中

我有一个托管在 Docker elastic beanstalk 中的 Django 应用程序。我需要将 django 日志文件保存在 s3 存储桶中。我们可以使用 AWS 控制台或使用“eb log”命令检索实例日志。

但要检索 django 日志,我们需要手动 ssh 到 eb 实例并检查它。

如果我们在 eb 配置中启用日志轮换,我们可以将实例日志保存在 s3 存储桶中。但是是否有任何类似的方法可以将 eb 实例 docker 容器内的 django 日志保存到 s3 存储桶。

django logging amazon-s3 amazon-elastic-beanstalk

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

无法通过主管“uwsgi:uwsgi_00: ERROR (spawn error)”配置 uwgi

我已经使用 uwsgi 和 nginx 运行了 django 应用程序。我正在使用 uwsgi python 包手动配置 uwsgi。现在我需要切换到主管来运行 uwsgi 进程。我创建了主管配置并启动了 uwsgi 进程并且该站点正在运行,但是当我使用 supervisorctl 命令启动 uwsgi 进程时出现以下错误

uwsgi:uwsgi_00: 错误(生成错误)

但是在服务器中创建了 8 个进程。我不确定为什么我会收到此错误。

我附上了我的主管配置和 uwsgi.ini 文件

[program:uwsgi]
command=/var/www/django/virtual/bin/uwsgi --ini /var/www/django/uwsgi.ini 
user=root
process_name = %(program_name)s_%(process_num)02d
autostart=true
autorestart=true
stderr_logfile=/var/www/django/super.log
stdout_logfile=/var/www/django/super.log
Run Code Online (Sandbox Code Playgroud)

uwsgi.ini 文件

[uwsgi]
 master          = true 
 socket          = /tmp/uwsgi.sock
 chmod-socket    = 666
 chdir           = /var/www/django/webserver_test
 wsgi-file       = /var/www/django/webserver_test/Django_app/wsgi.py
 virtualenv      = /var/www/django/virtual
 pythonpath      = /var/www/django/virtual/bin/python
 vacuum          = true
 enable-threads  = true
 daemonize= /var/www/django/uwsgi.log
Run Code Online (Sandbox Code Playgroud)

主管错误日志:

2017-05-29 09:49:50,953 INFO 产生:'uwsgi_00' with pid 20819 2017-05-29 …

uwsgi supervisord

5
推荐指数
0
解决办法
1332
查看次数

无法代理将AWS Kibana传递给nginx

我正在使用AWS kibana来搜索和查看Logstash索引的日志.现在我正在使用AWS的默认URL,仅限于我的IP地址.我需要通过nginx proxy_pass它,我试图遵循这个文档:https://sysadmins.co.za/aws-access-kibana-5-behind-elb-via-nginx-reverse-proxy-on-custom-dns /

但是kibana没有加载.我收到以下错误:

Kibana: Not Found
Error: Not Found
    at respond (http://IP/index.js?_b=7562:85344:15)
    at checkRespForFailure (http://IP/index.js?_b=7562:85312:7)
    at http://IP/index.js?_b=7562:83950:7
    at wrappedErrback (http://IP/index.js?_b=7562:20902:78)
    at wrappedErrback (http://IP/index.js?_b=7562:20902:78)
    at wrappedErrback (http://IP/index.js?_b=7562:20902:78)
    at http://IP/index.js?_b=7562:21035:76
    at Scope.$eval (http://IP/index.js?_b=7562:22022:28)
    at Scope.$digest (http://IP/index.js?_b=7562:21834:31)
    at Scope.$apply (http://IP/index.js?_b=7562:22126:24)
Run Code Online (Sandbox Code Playgroud)

添加Nignx conf:

    server {
      listen 80 default_server;
      listen [::]:80 default_server ipv6only=on;
      server_name kibana.mydomain.com;

      # for elb health checks
      location /status {
        root /usr/share/nginx/html/ ;
      }

      location / {
        proxy_set_header Host search-aws-es.eu-west-1.es.amazonaws.com;
        proxy_set_header X-Real-IP <public-ip-for-instance>;

        proxy_http_version 1.1;
        proxy_set_header Connection …
Run Code Online (Sandbox Code Playgroud)

nginx amazon-web-services kibana-4

5
推荐指数
0
解决办法
1262
查看次数

Nginx 目录遍历问题

我正在运行 Nginx 1.16.1 版本来为我的 Django 应用程序提供服务,并且还用作反向代理来为我的来自 tomcat 的 spring boot api 提供服务。以下是我的nginx配置:

server {

       listen 80 default_server;

       server_name domain_name;

       error_log /home/ubuntu/logs/nginx_error.log;
       access_log /home/ubuntu/logs/nginx_acess.log;

       location / {

           uwsgi_pass unix:///home/ubuntu/django-app/uwsgi.sock;
           include uwsgi_params;
        }

       location /api/ {

               proxy_pass http://localhost:9092/;
               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;
       }
}
Run Code Online (Sandbox Code Playgroud)

当我到达 URL 时:http://domain_name/api/v1/../../ 它登陆 django 主页。这是因为路径遍历漏洞。如果是这样,有没有办法克服这个问题?

tomcat nginx nginx-reverse-proxy

5
推荐指数
0
解决办法
633
查看次数

用于python3.4的httpd mod_wsgi不能在centos7中工作

我使用python3.4在centos7中运行Django应用程序.我正在使用apache进行webserver.我遇到以下错误:

[Tue Dec 05 09:48:17.048763 2017] [:error] [pid 8470] [remote 103.194.69.2:100] mod_wsgi(pid = 8470):目标WSGI脚本'/var/www/hello_world_django/hello_world_django/wsgi.py '无法加载为Python模块.[Tue Dec 05 09:48:17.049021 2017] [:error] [pid 8470] [remote 103.194.69.2:100] mod_wsgi(pid = 8470):处理WSGI脚本'/ var/www/hello_world_django/hello_world_django/wsgi发生异常的.py".[Tue Dec 05 09:48:17.049272 2017] [:错误] [pid 8470] [remote 103.194.69.2:100]回溯(最近一次电话会议):[Tue Dec 05 09:48:17.049383 2017] [:error] [pid 8470] [remote 103.194.69.2:100]文件"/var/www/hello_world_django/hello_world_django/wsgi.py",第13行,在[星期二05 09 09:48:17.049625 2017] [:错误] [pid 8470 ] [remote 103.194.69.2:100]来自django.core.wsgi import get_wsgi_application [Tue Dec 05 09:48:17.049661 2017] [:error] [pid 8470] [remote 103.194.69.2:100] File"/ var/www /virtual/lib/python3.4/site-packages/django/ init .py",第1行,在[Tue Dec 05 09:48:17.049711 2017] [:错误] [pid 8470] [remote …

apache mod-wsgi python-3.4 centos7

4
推荐指数
1
解决办法
3850
查看次数