我已经使用gunicorn和nginx通过ssh设置了我的django应用程序。
这是我的程序:
sudo gunicorn --workers=2 -b :8888 tutorial.wsgi:application
我启动nginx:sudo service nginx start
这是conf文件:
server {
listen 8002;
server_name wiser.omk.dk;
access_log /home/pikachu/access.log;
error_log /home/pikachu/error.log;
location /static {
root /home/pikachu/django_rest_sandbox_omk_prod/tutorial;
}
location / {
proxy_pass http://127.0.0.1:8888;
allow all;
}}
从localhost运行curl -i 127.0.0.1:8002
会返回HTTP 200
(按预期工作)
<remote domain>:8002
会产生"Connection refused"
查看iptables sudo iptables -L -n | grep 8002
:
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:8002
如果我在服务器上运行tcpdump:sudo tcpdump port 8002 -vv
TCPDump输出:
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
23:42:35.357580 IP (tos 0x0, ttl 57, id 16513, offset 0, flags [DF], proto TCP (6), length 64)
x1-6-f8-1e-df-e2-a1-2f.cpe.webspeed.dk.52181 > 10.32.0.104.8002: Flags [S], cksum 0xe91d (correct), seq 1169831423, win 65535, options [mss 1460,nop,wscale 5,nop,nop,TS val 965849406 ecr 0,sackOK,eol], length 0
为什么服务器不响应远程请求?