Articles of gunicorn

apachetesting页面显示在非apache服务器上

我手上有一个很奇怪的错误。 我正在Ubuntu 16.04上运行带有Nginx和Gunicorn的Django服务器。 我没有在我的服务器上安装Apache ANYWHERE。 但是,如果我加载网站,在CentOS上运行Apache的服务器的testing页面就会出现,而且我也没有在服务器上安装CentOS或Apache。 我的服务器正在发生什么事,如何让testing页消失? 附件是网站上出现的Apachetesting页面的屏幕截图 。 更新:看来Apache 是安装在我的本地机器上。 会清除它的伎俩?

Django,Nginx和Gunicorn上的SSL

我使用Nginx和gunicorn来为我的Django项目服务。 我目前正在为SSL(https)工作,但不太了解设置文件和Nginx的正确设置。 有人可以看看我的设置,并告诉我,如果有任何公然看起来错误,或可怕的执行? 我的Nginx文件,请注意,有些行被注释掉。 当我取消注释时,该网站停止工作。 编辑:当我在同一时间/ server { server_name example.com; listen 443 ssl; ssl on; ssl_certificate /etc/ssl/mycrt.crt; ssl_certificate_key /etc/ssl/mykey.key; location = /favicon.ico {access_log off; log_not_found off;} location /static/ { gzip on; gzip_types text/css; alias /home/project/static/; } location / { include proxy_params; # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; # proxy_set_header Host $http_host; # proxy_redirect off; […]

Django查询永远运行,不超时

我有一些Django的应用程序,是我的MySQL服务器正在查询有正在运行的查询,不超时和阻塞我的MySQL服务器 只是需要帮助,如何解决这个问题的正确方法不知道这是如何devisedjango,或者我需要添加超时设置,我想django应该这样做默认情况下,不知道,因为使零感觉没有超时 这里是不超时或closures的查询 MySQL on localhost (5.7.19) load 5.27 4.81 4.69 4/2383 41852 up 0+00:18:41 [19:13:16] Queries: 8.6k qps: 8 Slow: 0.0 Se/In/Up/De(%): 61/01/02/00 Sorts: 0 qps now: 5 Slow qps: 0.0 Threads: 99 ( 99/ 1) 44/00/00/00 Key Efficiency: 98.9% Bps in/out: 839.8/22.3k Now in/out: 566.3/22.5k Id User Host/IP DB Time Cmd State Query […]

CSS不能在Django网站上运行

这个网站是生活和数字海洋主办。 我终于得到它正常工作,但CSS不会在网站上工作? 这是我设置,没有错误,只是CSS将无法正常工作。 我有这在我的settings.py: STATIC_URL = '/static/' STATIC_ROOT = '/static/' STATIC_DIR = os.path.join(BASE_DIR,'static') STATICFILES_DIRS = [ STATIC_DIR, ] 这里是我的项目urls.py: from django.conf.urls import url from django.contrib import admin from django.conf.urls import include from blog import views from users import views from feed import views from django.conf import settings from django.conf.urls.static import static urlpatterns = [ url(r'^admin/', […]

Nginx将每个urlredirect到localhost

我有一个运行Nginx和Gunicorn的Django网站。 每次我在服务器上调用一个url,例如website / url,它就会redirect到localhost / url。 我在nginx.conf和sites-available / site-name中给出了nginx设置 nginx.conf: user www-data; worker_processes auto; pid /run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## client_max_body_size 5M; 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 application/octet-stream; […]

没有findDjango的/pipe理员

我尝试设置Nginx + Gunicorn ,当我通过URL访问时, Nginx将请求redirect到我的应用程序,并通过itsels处理静态资源( static文件夹)。 在我的Nginx域configuration下面: server { listen 80; server_name asknow.local www.asknow.local; root /home/ghostman/Projects/asknow/asknow; location = /favicon.ico { access_log off; log_not_found off; } location = /static/ { root /home/ghostman/Projects/asknow/asknow; } location = / { include proxy_params; proxy_pass http://unix:/home/ghostman/Projects/asknow/asknow/asknow.sock; } } 我需要Nginx自己处理请求的问题( www.asknow.local/static ),但它也尝试处理其他URL。 所以当我现在去www.asknow.local/admin Nginx会尝试通过path( my_project/admin )来查找资源。 Nginx日志 2017/11/01 04:27:22 [error] 13451#13451: *1 […]

如何使用Flask应用程序更新来更新网站

我是一个总是新手,从来没有学到任何有关Linux,服务器或烧瓶,直到今天。 但是我喜欢python,所以我按照这个教程来configuration一个VPS并用烧瓶创build一个网站。 这个教程工作正常,我能够build立我的网站。 但是我没有看到如何更新文件。 这就是我所做的。 教程完成后,网站使用“这是一个例子”等基本数据。 我在我的Windows电脑上创build了我的烧瓶应用程序的改进版本。 我用FileZilla上传新的更新的myproject文件,静态和模板文件夹和一些PNG图像,使用SFTP连接。 当我进入我的网站,它仍然显示旧的基本版本“这是一个例子”,而不是新的上传的文件。 第4步显然是我卡住的地方。 网站不更新。 我在此之前所做的事情。 Flask应用程序在我的本地主机上工作。 那里没有问题。 我在ubuntu服务器上用nano检查过,filezilla实际上把这些file upload到了服务器上。 是的,更新的myproject.py文件在那里。 还尝试了下一个命令,试图重新加载一切: sudo systemctl守护进程重新加载 sudo systemctl启动webgutinberg sudo systemctl启用webgutinberg sudo systemctl重启nginx 所以…我错过了什么? 奖金:我也知道如何自动更新每个file upload到服务器的网站。 我的意图是将图像添加到画廊,我希望file upload到服务器后立即显示它们。 如果可能的话,避免使用databases.f 修复了我自己的问题: sudo systemctl status myproject sudo systemctl status myproject | sed -n 's/.*Main PID: \(.*\)$/\1/gp' | cut -f1 -d' ' | xargs kill […]

任何虚拟环境都可以为所有virtuenenv启动systemd gunicorn.service吗?

如果你不在一个环境中工作,Gunicorn将被安装在全球范围内(即全系统可用)。 这不被推荐。 总是select使用virtualenv。 但是,如果你有多个virtualenvs多lessgunicorn.service文件,你应该启动在系统启动gunicorn? 例如下面 WorkingDirectory=/home/myproject… ExecStart==/home/myproject/myprojectenv/bin/gunicorn… 任何虚拟环境能否为所有virtudenv启动?

如何在centos中启动gunicorn作为服务6

我使用下面的configuration文件在centos 7中启动gunicorn作为systemd servivce。 但systemd没有在centos中find6.那么如何启动gunicorn作为服务? [Unit] Description=gunicorn daemon After=network.target [Service] User=centos Group=centos WorkingDirectory=/opt/myapp/ ExecStart=/opt/venv/bin/gunicorn –workers 3 –bind 127.0.0.1:8080 controller.wsgi:application [Install] WantedBy=multi-user.target 上面的文件被复制到“/etc/systemd/system/gunicorn.service”在centos 7.但是我怎样才能在centos 6中实现相同的?

如何将PHP添加到已经运行nginx + gunicorn + django的linux(ubuntu)服务器上

我一直在Ubuntu上使用gunicorn(现在的版本12.04)在nginx上运行一个django应用程序一段时间了,并且对结果感到满意。 我的问题是,我已经inheritance了我想在同一台服务器上运行的PHP网站。 任何人都可以给我一些build议,什么可能是最好的方式来添加PHP到我的服务器设置?