Comments (32)
还有我以前用了创建 uWSGI 配置文件来运行。我不知道用gunicorn -w 4 wsgi:app后 断开服务器 会一直运行吗?
from blogin.
我在看你的博客:https://2dogz.cn/blog/article/2/ 我看你是在/etc/nginx/sites-available/里配置文件。 我以前部署在aws ec2 是在 /etc/nginx/sites-enabled/建的配置文件文件 我想问一下有啥区别。
- sites-enabled 下的文件,会作为 nginx.conf 的一部分加载
- sites-enabled 下的用于存放 sites-available 中文件的软连接
这种问题其实你自己搜一下就知道结果,或者看Nginx的文档
from blogin.
还有我以前用了创建 uWSGI 配置文件来运行。我不知道用gunicorn -w 4 wsgi:app后 断开服务器 会一直运行吗?
你连接了云服务器在ssh终端执行gunicorn你断开SSH之后进程肯定会死掉,有三种方法可以让gunicorn一直运行
- 在
/etc/systemd/system/
目录下新建一个service
,然后通过service
或者systemctl
启动这个service
- 配合supervisor具体方法见 https://2dogz.cn/blog/article/3/
- 使用nohup的方式运行
gunicorn
from blogin.
@weijiang1994 OK 谢谢。我问一下我再次gunicorn -w 4 wsgi:app出现了下面问题。网页也打不开。
gunicorn -w 4 wsgi:app
[2021-10-29 03:12:42 +0000] [20653] [INFO] Starting gunicorn 20.1.0
[2021-10-29 03:12:42 +0000] [20653] [ERROR] Connection in use: ('127.0.0.1', 8000)
[2021-10-29 03:12:42 +0000] [20653] [ERROR] Retrying in 1 second.
[2021-10-29 03:12:43 +0000] [20653] [ERROR] Connection in use: ('127.0.0.1', 8000)
[2021-10-29 03:12:43 +0000] [20653] [ERROR] Retrying in 1 second.
[2021-10-29 03:12:44 +0000] [20653] [ERROR] Connection in use: ('127.0.0.1', 8000)
[2021-10-29 03:12:44 +0000] [20653] [ERROR] Retrying in 1 second.
[2021-10-29 03:12:45 +0000] [20653] [ERROR] Connection in use: ('127.0.0.1', 8000)
[2021-10-29 03:12:45 +0000] [20653] [ERROR] Retrying in 1 second.
[2021-10-29 03:12:46 +0000] [20653] [ERROR] Connection in use: ('127.0.0.1', 8000)
[2021-10-29 03:12:46 +0000] [20653] [ERROR] Retrying in 1 second.
[2021-10-29 03:12:47 +0000] [20653] [ERROR] Can't connect to ('127.0.0.1', 8000)
from blogin.
@weijiang1994 OK 谢谢。我问一下我再次gunicorn -w 4 wsgi:app出现了下面问题。网页也打不开。 gunicorn -w 4 wsgi:app [2021-10-29 03:12:42 +0000] [20653] [INFO] Starting gunicorn 20.1.0 [2021-10-29 03:12:42 +0000] [20653] [ERROR] Connection in use: ('127.0.0.1', 8000) [2021-10-29 03:12:42 +0000] [20653] [ERROR] Retrying in 1 second. [2021-10-29 03:12:43 +0000] [20653] [ERROR] Connection in use: ('127.0.0.1', 8000) [2021-10-29 03:12:43 +0000] [20653] [ERROR] Retrying in 1 second. [2021-10-29 03:12:44 +0000] [20653] [ERROR] Connection in use: ('127.0.0.1', 8000) [2021-10-29 03:12:44 +0000] [20653] [ERROR] Retrying in 1 second. [2021-10-29 03:12:45 +0000] [20653] [ERROR] Connection in use: ('127.0.0.1', 8000) [2021-10-29 03:12:45 +0000] [20653] [ERROR] Retrying in 1 second. [2021-10-29 03:12:46 +0000] [20653] [ERROR] Connection in use: ('127.0.0.1', 8000) [2021-10-29 03:12:46 +0000] [20653] [ERROR] Retrying in 1 second. [2021-10-29 03:12:47 +0000] [20653] [ERROR] Can't connect to ('127.0.0.1', 8000)
你这报错是因为你本地8000端口已经被占用了。不能访问的原因是因为你启动在127.0.0.1上面,如果需要通过ip:port远程访问,执行下面的命令
gunicorn -w 4 -b 0.0.0.0:8000 wsgi:app
通过下面的命令杀死你已经启动的8000端口进程
ps -aux | grep gunicorn
sudo kill -9 gunicorn_pid # 上面找到的gunicorn进程的pid
from blogin.
这种博客的小网站gunicorn就够用了,没必要上Nginx进行反向代理,杀鸡焉用宰牛刀?
from blogin.
Hi @weijiang1994 我的
[program:Blogin]
command=/home/ubuntu/Blogin/bash.sh
directory=/home/Blogin/SciSci
user=root
autostart=true
*autorestart=true
stopasgroup=true
killasgroup=true
sudo supervisorctl
#! /bin/bash
cd /home/ubuntu/Blogin
exec gunicorn -w 4 wsgi:app
但是运行不成功
sudo service supervisor restart
sudo supervisorctl
Blogin FATAL Exited too quickly (process log may have details)
from blogin.
Blogin FATAL Exited too quickly (process log may have details)
from blogin.
你意思是process log?这个在哪里process log?
from blogin.
一般在/var/log/supervisor
目录
from blogin.
@weijiang1994 我加了一个startsecs=0 在blog.conf文件中。
虽然可以:RUNNING pid 7138, uptime 0:00:00
但是我发现网页打不开。
502 Bad Gateway
nginx/1.14.0 (Ubuntu)
#! /bin/bash
cd /home/ubuntu/Blogin
exec gunicorn -w 4 wsgi:app
为啥你的blogin文件下是: exec gunicorn -c gunicorn_conf.py wsgi:app
多了一个gunicorn_conf.py
from blogin.
502说明你NGINX反向代理没有配置正确
from blogin.
@weijiang1994 我开始只用gunicorn -w 4 wsgi:app 网页可以打开啊
from blogin.
不清楚你怎么配置的,我也搞不清楚原因。
from blogin.
@weijiang1994 为啥大家使用不同呢
https://blog.csdn.net/guolindonggld/article/details/83386920
from blogin.
@weijiang1994 我感觉是不是安装问题, 为啥是python2版本的supervisor
sudo apt-get install supervisor
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-meld3 python-minimal python-pkg-resources python2.7 python2.7-minimal
Suggested packages:
python-doc python-tk python-setuptools python2.7-doc binfmt-support supervisor-doc
The following NEW packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-meld3 python-minimal python-pkg-resources python2.7 python2.7-minimal supervisor
0 upgraded, 10 newly installed, 0 to remove and 36 not upgraded.
Need to get 0 B/4382 kB of archives.
from blogin.
不是很清楚,我的ubuntu1604没有问题
from blogin.
@weijiang1994 你好 commnd加上了/usr/bin/python3 /home/ubuntu/.local/bin/gunicorn -w 4 wsgi:app supervisor OK啦 还有user改成ubuntu 成功了。
但是我发现我chrome浏览器无法域名访问,只能用ip地址访问,但是safari浏览器可以域名访问。并且手机上访问苹果浏览器也不行。很奇怪。不知道怎么解决。
我记得当时只是单纯在terminal运行gunicorn -w 4 wsgi:app 时候域名可以访问。
from blogin.
我今天写博客时候 点击提交后出现了这个问题:
/10/31 00:59:28 [error] 10234#10234: *1338 client intended to send too large body: 1539034 bytes,
from blogin.
Nginx中设置的最大文件大小过小
from blogin.
@weijiang1994 哪个文件 这个吗do vim /etc/nginx/sites-available/default?
from blogin.
自己搜一下
from blogin.
@weijiang1994 OK啦 修改完。加了client_max_body_size 1024M; 在/etc/nginx/nginx.conf里。
@weijiang1994 这个在哪里修改啊 我想修改成支持jpeg格式。
还有我上传我手机以前拍摄的照片为啥不可以啊 说直接受jpd和png图片。但是我选择实时拍摄,然后上传照片就可以。
from blogin.
@weijiang1994 我修改以前的博客,但是点击提交后出现了错误
FileNotFoundError: [Errno 2] No such file or directory: '/Users/xx/PycharmProjects/Blogin/history/41590fc30458a88c584b7c8dedfa5749.txt'
from blogin.
这种错误你应该知道怎么解决吧?
from blogin.
@weijiang1994 我加了history文件夹。
from blogin.
@weijiang1994 你是不是登录我的后台啦
from blogin.
@weijiang1994 你是不是登录我的后台啦
我没登录啊,我只是注册了账号而已...
from blogin.
@weijiang1994 好的 我得修改一下代码。我看你超级管理员
from blogin.
你可以改一下代码,因为我当初把通过我的邮箱注册账号自动设置为超级管理员
from blogin.
from blogin.
@weijiang1994 到此为止,谢谢你的指导。我后面会对网站进行修改一下 增加一些我的特色。不过暂时只是写写博客,时间有限。
from blogin.
Related Issues (20)
- 我打算开发一个活动栏目。 HOT 2
- 请问如何部署到服务器? HOT 3
- 其它操作系统 HOT 20
- jinja2.exceptions.TemplateNotFound: main/index.html HOT 16
- 博客继续阅读 按钮 HOT 4
- 部署到AWS ec2 ubuntu 上出现了问题
- blueprint/front/blog.py", line 404, in load_one return jsonify({'one': one.content}) AttributeError: 'NoneType' object has no attribute 'content'
- 相应文件缺失? HOT 1
- 请问怎么解决configparser.NoSectionError: No section: 'baidu' HOT 2
- 大佬,请问这是什么原因啊 HOT 8
- 个人博客云端部署问题 HOT 2
- AttributeError: 'Babel' object has no attribute 'localeselector' HOT 6
- 进首页显示404 HOT 13
- 请问FileNotFoundError: [Errno 2] No such file or directory: 'E:\\_Study_Record\\git_files\\m_blog/history/e29c91a7c65dfdd2b5bff4294f4a5138.txt'怎么解决啊 HOT 2
- 博客地址无法访问了 HOT 6
- 后台 博客编辑栏 操作按钮无法点击 HOT 10
- avatar文件路径的问题 HOT 1
- 初始化数据库命令失败 HOT 13
- 依赖的文件缺失 HOT 3
- 作者您好,请问python用的是哪个版本的 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blogin.