在开发模式(本地)下,访问花页非常容易(http://localhost:5555)
但是在生产模式下,很难访问花页。
我想使用这个网址访问花卉仪表板页面:
https ://spacegraphy.choislaw.xyz/flower/(域名:choislaw.xyz)
我参考了http://flower.readthedocs.io/en/latest/reverse-proxy.html#reverse-proxy这就是我所做的:
nginx.conf
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
server {
listen 80;
server_name spacegraphy.choislaw.xyz;
client_max_body_size 4G;
keepalive_timeout 5;
return 301 https://$server_name$request_uri;
}
# HTTPS server
server {
listen 443 default_server ssl;
server_name spacegraphy.choislaw.xyz;
client_max_body_size 4G;
keepalive_timeout 5;
ssl_certificate /etc/letsencrypt/live/spacegraphy.choislaw.xyz/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/spacegraphy.choislaw.xyz/privkey.pem;
location / {
proxy_pass_header X-CSRFToken;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header HOST $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:4349;
proxy_redirect off;
}
# Flower
location /flower/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header HOST $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_pass http://localhost:5555/;
proxy_redirect off;
}
}
}
我执行花服务器:
$ celery --workdir=spacegraphy/ --app=spacegraphy.celery:app flower
我访问https://spacegraphy.choislaw.xyz/flower/,它显示如下:
如果我点击任何链接,
我错过了什么?我是否将花服务器与应用程序服务器分开?
顺便说一句,通常在生产服务器上运行花服务器吗?