我正在尝试使用X-Accel-Redirect标头按照本教程(和许多其他)使用nginx来提供受保护的文件。 物理path: /home/media/file.pdf url: example.com/media/file.pdf nginxconfiguration: location /media/ { internal; alias /home/; } 在Django中,我有一个中间件,它检查用户是否被authentication,如果是的话,使用X-Accel-Redirect for nginx来传递文件: response["X-Accel-Redirect"] = request.path 当我尝试访问文件时,我得到404错误(访问日志中请求的文件path正常)。 在我看来,Nginx不会将请求传递给Django,只是以404错误结束。 任何想法我可能做错了什么? 有没有一个好的方法来debugging呢? 提前致谢。
我是Google App Engine的新手,我的Django应用程序的部署出现了一个非常奇怪的错误,这似乎与缺乏Alpha Access权限有关。 错误说: Updating service [default]…failed. ERROR: (gcloud.app.deploy) Error Response: [13] Deployment Manager operation failed, name: operation-1480541820504-5428b814947c1-dfa6ed37-d2b5ecf3, error: [{"code":"RESOURCE_ERROR","location":"/deployments/aef-default-20161130t213509/resources/aef-default-20161130t213509-00","message":"Unexpected response from resource of type compute.alpha.regionInstanceGroupManager: 403 {\"code\":403,\"errors\":[{\"domain\":\"global\",\"message\":\"Required 'Alpha Access' permission for 'Compute API'\",\"reason\":\"forbidden\"}],\"message\":\"Required 'Alpha Access' permission for 'Compute API'\",\"statusMessage\":\"Forbidden\",\"requestPath\":\"https://www.googleapis.com/compute/alpha/projects/elumin-dev-us/regions/us-central1/instanceGroupManagers\"}"} 任何人都可以摆脱任何光? 我已经尝试了两个不同的项目,并得到完全相同的错误。 上传结果是一个正在运行的应用程序版本,当访问时会引发500个服务器错误。 据我所知,应用程序没有什么特别的。 它不是试图访问除本身以外的任何资源。 它在本地主机上运行良好,甚至连接到云数据库实例。 我的app.yaml文件如下: # [START runtime] runtime: python env: flex […]
我使用数字海洋云服务器的Ubuntu 14.04 Apache的托pipe。 而托pipe我这样设置项目文件夹的权限: chown -R :www-data <project_dir_name> chmod -R 760 <project_dir_name> # 这里我给了www-data(group)的权限来读写。 在这种情况下,我不能在浏览器中使用URL访问项目,但是如果我给770工作的罚款,而不是760。 那么为什么需要执行(770)许可到project_directory才能通过url访问。 会导致任何安全问题。 有人请帮助我,如果问题不对,有人请帮我纠正这个问题
我可以运行systemctl restart gunicorn && systemctl restart nginx没有sudo ? 目前我得到: 出:authentication是需要重新加载'gunicorn.service'。 out:身份validation:myuser 输出:密码: # coding: utf-8 from fabric.api import * from fabric.colors import green, red def production(): env.host_string = '159.xxx.xxx.xx' env.user = 'myuser' path = "/home/myuser/myproject/myproject" print(red("Beginning Deploy:")) with cd(path): with prefix('. /home/myuser/myproject/myenv/bin/activate'): run("pwd") print(green("Pulling master from git…")) run("git pull") print(green("Migrate the database…")) run("python3 manage.py migrate") […]
我正在使用opbeat在Django应用程序上进行错误报告。 我的应用程序在Ubuntu 15.10的服务器上运行,并使用UFW进行防火墙安全。 不幸的是,防火墙也阻止了从我的服务器发送到他们的云的错误报告opbeat。 Opbeat的支持告诉我,他们的接口连接的端口是什么,我允许来自该端口的所有传入和传出通信。 另外,我允许来往于当前IP地址的stream量。 由于他们使用AWS,他们拥有dynamic的IP地址,所以这只是一个临时解决scheme。 但是,即使使用当前的IP,防火墙仍然不允许错误消息通过。 有没有其他人使用ufw可能有解决scheme的opbeat? 谢谢! 编辑 以下是sudo ufw status verbose的输出。 我已经截断它去除任何不需要做opbeat的IP。 另外,主pipe/ gunicorn运行我的应用程序在端口9000,我有端口8081清漆caching的应用程序。 那些是非标准的,所以值得一提。 Status: active Logging: on (low) Default: deny (incoming), deny (outgoing), deny (routed) New profiles: skip To Action From — —— —- 80 ALLOW IN Anywhere 443 ALLOW IN Anywhere 80/tcp (Nginx HTTP) ALLOW IN Anywhere 443/tcp […]
我正在制作一个Django项目。 但是我正在处理一个奇怪的权限问题。 毕竟,这是我的项目的结构: 项目 项目 settings.py urls.py wsgi.py … 应用 APP1 APP2 APP3 日志 静态的 … 部署它时,除非www-data是项目/项目/应用程序 (recursion)的用户所有者或组所有者,否则该站点将不会运行,只要它具有775或550的权限。 它有一个HTTP 500错误 奇怪的是,当我更改权限到777 ,并从www数据中删除所有权,我仍然有相同的HTTP 500错误。 通常的错误是一个ImportError。 它不能导入一些模块/应用程序。 现在我的问题是为什么呢? 至less有权限777 ,它应该运行www-data将无论如何拥有文件夹项目/项目/应用程序的完全权限 看起来好像Apache( www-data )只想拥有这个文件夹(无论是在组级别还是用户级别) 如何在使用Apache进行部署时,在django项目文件夹上设置权限?
你好,谢谢你的帮助。 我search了,发现了类似的问题,但不是我所经历的。 当我尝试configurationnginx来服务我的应用程序时,我得到“太多redirect”。 这是:80服务器configuration server{ listen 80; listen [::]:80; server_name app.domain.com; location /{ # This is an acceptable config: If request went trought http, # redirect to https server if ($scheme = "http"){ return 301 https://$host$request_uri; } # This is what i REALLY want: If request went trought http (this # server is listening port […]
我维护的一个基于Django的networking论坛最近在应用层受到频繁的DDOS攻击。 本质上,它似乎是一个HTTP泛滥的主页,造成服务器执行大量的内部请求,并加载各种文件来创build页面。 洪水峰值约为每分钟4000个请求(典型的吞吐量为500转/分钟左右),导致我的服务器在这个过程中。 我的networking服务器是nginx,作为一个gunicorn应用服务器的反向代理。 我还没有使用gunicorn的安全参数: limit_request_line , limit_request_fields , limit_request_field_size )。 但是我已经安装了nginx fail2ban ,并且在我的jail.local有两个jail来确保HTTP floods被挫败: [nginx-postflood] enabled = true filter = nginx-postflood port = http,https logpath = /var/log/nginx/access.log findtime = 60 maxretry = 13 bantime = 300 [nginx-getflood] enabled = true filter = nginx-getflood port = http,https logpath = /var/log/nginx/access.log findtime = 5 maxretry = […]
我们有这个网站已经很好的工作,但我已经把任务指向另一个url到同一个网站。 这个想法是,两个url将显示在地址栏,但只有一个网站将显示。 我向我的DNSpipe理站点添加了一个Alogging,以将新的域名指向我的旧站点所在的服务器的IP地址,并接收传统的页面 “欢迎来到nginx!如果你看到这个页面,…” 因此,在研究如何configuration我的服务器,我遇到了这个看起来很有希望的网站 ,使任务看起来很简单。 所以我所做的是在我的/etc/nginx/sites-available/beta.conf和我的/etc/nginx/sites-enabled/beta.conf中重复我的server { … } (请注意唯一的区别server块之间是server_name )。 nginx.conf: user www-data; worker_processes 4; pid /run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type […]
我很困惑。 我犯错的地方? 项目文件位置: /home/username/www /etc/uwsgi/sites/mysite.com [uwsgi] project = www base = /home/username uid = www-data gid = www-data chdir = %(base)/%(project) home = %(base)/.virtualenvs/%(project) module = %(project).wsgi:application master = true processes = 5 socket = %(base)/%(project)/%(project).sock chmod-socket = 664 vacuum = true /etc/init/uwsgi.conf: description "uWSGI application server in Emperor mode" start on runlevel [2345] stop […]