Linux + Flask + Nginx部署

Linux + Flask + Nginx部署

  1. 下载并配置Nginx(很重要)

参考地址:https://blog.csdn.net/king_kgh/article/details/74973040

nginx配置文件(前端打包dist时,代理IP要使用公网IP)

server {
#端口
listen 端口;
server_name Linux公网IP;
location / {
root /root/project/code/dist; # 前端web
index index.html index.htm;
try_files $uri KaTeX parse error: Expected 'EOF', got '}' at position 17: …ri/ @router; }̲ location @ro… /index.html last;
}
location /api {
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:5000; # flask服务
}
location /socket {
proxy_pass http://127.0.0.1:5002; # websocket地址

你可能感兴趣的:(Linux文档)