https://blog.csdn.net/cjqh_hao/article/details/105056180
项目部署方式包括独立部署,supervisor部署和服务器部署
独立部署即执行项目下的可执行文件
supervisor部署则是将可执行文件放入supervisor的监控配置
服务器部署即通过nginx或apache来转发请求到beego的监听接口(server即代理)
nginx部署配置如下:
server {
listen 80;
server_name template.com;
charset utf-8;
access_log /usr/local/nginx/logs/template-access.log;
error_log /usr/local/nginx/logs/template-error.log;
location ~ .*\.(js|css)?$
{
#access_log off;
#expires 1d;
#该文件是你beego项目中的static静态文件路径
root "/media/go/src/test/static";
try_files $uri @backend;
}
location / {
try_files /_not_exists_ @backend;
}
location @backend {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:8080;
}
}
参考文档
https://beego.me/docs/deploy/beego.md