分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 技术分享

阿里云 asp.net core ?nginx ?单机部署

发布时间:2023-09-06 02:10责任编辑:苏小强关键词:nginx

1. dotnet core 安装 https://www.microsoft.com/net/download#core 
安装之前要安装依赖:yum install libunwind libicu

2.nginx 安装 
yum install nginx 
systemctl start nginx 
3. dotnet 后台运行 
startup 文件增加: 
app.UseForwardedHeaders(new ForwardedHeadersOptions 

ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto 
}); 
使用supervisor 启动 
https://www.cnblogs.com/ants/p/5732337.html#_label6 
在这个目录下:/etc/supervisor/conf.d

supervisorctl stop all 关闭所有应用 
supervisorctl reload 重新加载配置 
supervisorctl start all 启动所有应用 
supervisord -c /etc/supervisor/supervisord.conf 
有时候会出问题,需要手动kill掉进程 
ps -ef | grep supervisor 查看有几个进程 
netstat -lnp |grep 5001 查看占用5001 端口的进程 
kill -9 xxxx 手动杀掉进程 
4. 配置代理

server { 
listen 80; 
server_name example.com *.example.com; 
location / { 
proxy_pass http://localhost:5001; 
proxy_http_version 1.1; 
proxy_set_header Upgrade $http_upgrade; 
proxy_set_header Connection keep-alive; 
proxy_set_header Host $http_host; 
proxy_cache_bypass $http_upgrade; 

}

最终nginx 配置如下:

server { ???listen ??????443; ???listen ??????[::]:443; ???server_name ?agent.bdvip.net agent.bdvip01.com; ???ssl on; ?????ssl_certificate ?????/etc/nginx/ssl/bdvip.crt; ?????ssl_certificate_key ?/etc/nginx/ssl/bdvip.key; ???ssl_session_cache ???shared:SSL:1m; ?????ssl_session_timeout ?5m; ?????ssl_ciphers ?HIGH:!aNULL:!MD5; ?????ssl_prefer_server_ciphers ?on; ?????#root ????????/usr/share/nginx/html; ???# Load configuration files for the default server block. ???#include /etc/nginx/default.d/*.conf; ???location / { ????proxy_pass ????????http://localhost:5001; ????proxy_http_version 1.1; ????proxy_set_header ??Upgrade $http_upgrade; ????proxy_set_header ??Connection keep-alive; ????proxy_set_header ??Host $http_host; ????proxy_cache_bypass $http_upgrade; ???} ???##weex 目录 ???location /weex/ { ???????root /var/www/; ???????##过期时间单位天 ???????expires 7d; ???} ???location ~^/favicon\.ico$ { ???????root ??/var/www/; ???} ???error_page 404 /404.html; ???????location = /40x.html { ???} ???error_page 500 502 503 504 /50x.html; ???????location = /50x.html { ???}}

在/etc/nginx 目录下 
nginx 命令 
service nginx restart 
/etc/init.d/nginx stop 
/etc/init.d/nginx start

阿里云 asp.net core ?nginx ?单机部署

原文地址:https://www.cnblogs.com/chenzhe/p/9495312.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved