V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  tmackan  ›  全部回复第 7 页 / 共 7 页
回复总数  138
1  2  3  4  5  6  7  
2016-08-23 14:13:32 +08:00
回复了 tmackan 创建的主题 Python 测试 uwsgi 报错
在服务器 cmd 下运行
curl -i 'http://127.0.0.1:8001/'
显示:
HTTP/1.1 200 OK
Content-Type: text/html

并没有显示 hello world
2016-08-23 13:48:46 +08:00
回复了 tmackan 创建的主题 Python 测试 uwsgi 报错
当我浏览器中输入 ip:8001 时, cmd 显示信息如下:
```[pid: 2444|app: 0|req: 11/11] 123.121.1.79 () {38 vars in 667 bytes} [Tue Aug 23 13:47:34 2016] GET / => generated 0 bytes in 0 msecs (HTTP/1.1 200) 1 headers in 44 bytes (11 switches on core 0)
[pid: 2444|app: 0|req: 12/12] 123.121.1.79 () {36 vars in 594 bytes} [Tue Aug 23 13:47:35 2016] GET /favicon.ico => generated 0 bytes in 0 msecs (HTTP/1.1 200) 1 headers in 44 bytes (11 switches on core 0)
```
2016-08-23 13:47:09 +08:00
回复了 tmackan 创建的主题 Python 测试 uwsgi 报错
uwsgi 安装方式:
pip install uwsgi
2016-08-23 13:26:23 +08:00
回复了 tmackan 创建的主题 Python 测试 uwsgi 报错
--wsgi-file /alidata/websites/LandsBLog/test.py

路径没有问题
2016-08-23 10:16:23 +08:00
回复了 tmackan 创建的主题 Python virtualenv 部署 Django 项目
@restran 但是还是想折腾下
2016-08-22 18:29:08 +08:00
回复了 tmackan 创建的主题 NGINX nginx Failed to read PID from file /run/nginx.pid: Invalid argument
@lhbc 还没有申请域名
填写的是 ip:端口号
2016-08-22 18:28:21 +08:00
回复了 tmackan 创建的主题 NGINX nginx Failed to read PID from file /run/nginx.pid: Invalid argument
@lhbc server_name 填写的是 ip 地址
2016-08-22 18:06:21 +08:00
回复了 tmackan 创建的主题 NGINX nginx Failed to read PID from file /run/nginx.pid: Invalid argument
@lhbc 显示拒绝了连接请求
2016-08-22 18:02:41 +08:00
回复了 tmackan 创建的主题 NGINX nginx Failed to read PID from file /run/nginx.pid: Invalid argument
@lhbc 你好, nginx 正常启动了
我用 uwsgi 开启了一个服务,分配了对应的端口号,防火墙也已经关闭,但是通过 IP 还是访问不了
可能是什么原因呢?
2016-08-22 17:08:21 +08:00
回复了 tmackan 创建的主题 NGINX nginx Failed to read PID from file /run/nginx.pid: Invalid argument
@lostsquirrel
这个文件的确存在
文件内容是
13423
2016-08-22 16:35:01 +08:00
回复了 tmackan 创建的主题 Python virtualenv 部署 Django 项目
@clino 我用 virtual wrapper 管理所有的虚拟环境
2016-08-22 16:32:43 +08:00
回复了 tmackan 创建的主题 NGINX nginx Failed to read PID from file /run/nginx.pid: Invalid argument
坐等大神
2016-08-22 13:16:06 +08:00
回复了 tmackan 创建的主题 Python virtualenv 部署 Django 项目
执行
netstat -ntulp |grep 80
发现 uswgi 服务已经启动了
tcp 0 0 0.0.0.0:8077 0.0.0.0:* LISTEN 980/uwsgi
2016-08-22 11:33:31 +08:00
回复了 tmackan 创建的主题 Python virtualenv 部署 Django 项目
@tmackan

test.py
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return "Hello World"
2016-08-22 11:29:25 +08:00
回复了 tmackan 创建的主题 Python virtualenv 部署 Django 项目
@clino 我 uid 分配了一个用户, gid 也分配了一个用户组,但是还是提示我以 root 用户启动 uwsgi 服务
2016-08-22 11:15:08 +08:00
回复了 tmackan 创建的主题 Python virtualenv 部署 Django 项目
现在我以 workon blog 开启了虚拟环境,然后以 cmd 的方式开启了 uwsgi 服务
uwsgi --http :8000 --wsgi-file test.py
日志显示如下:

*** Starting uWSGI 2.0.13.1 (64bit) on [Mon Aug 22 10:58:14 2016] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-4) on 19 August 2016 14:24:34
os: Linux-3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015
nodename: iZ230ph83b2Z
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /alidata/websites/LandsBLog
detected binary path: /root/.virtualenvs/blog/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 7283
your memory page size is 4096 bytes
detected max file descriptor number: 65535
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :8000 fd 4
spawned uWSGI http 1 (pid: 855)
uwsgi socket 0 bound to TCP address 127.0.0.1:45769 (port auto-assigned) fd 3
Python version: 3.4.1 (default, Aug 19 2016, 10:38:55) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0xc20b00
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72768 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0xc20b00 pid: 854 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 854, cores: 1)

在浏览器上输入 IP : 8000 显示无法访问,求解。
2016-08-19 15:12:56 +08:00
回复了 tmackan 创建的主题 Python virtualenv 部署 Django 项目
@pc10201 也是奇怪了
2016-08-19 14:59:48 +08:00
回复了 tmackan 创建的主题 Python virtualenv 部署 Django 项目
(blog) [root@iZ230ph83b2Z LandsBLog]# which python
/root/.virtualenvs/blog/bin/python

(blog) [root@iZ230ph83b2Z LandsBLog]# which uwsgi
/root/.virtualenvs/blog/bin/uwsgi
1  2  3  4  5  6  7  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2418 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 16ms · UTC 14:42 · PVG 22:42 · LAX 07:42 · JFK 10:42
Developed with CodeLauncher
♥ Do have faith in what you're doing.