阿里云 asp.net core 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
最新文章
- java 数组中插入新的元素
- Android SnackBar使用方法
- hdu 3271 SNIBB 数位DP+二分
- URL中有中文字符,转码方法
- php中 0 与 字符串比较的问题
- vector 对象中存放指针类型数据
- Java数据结构和算法(八)——递归
- Scala入门系列(十二):隐式转换
- LeetCode之“树”:Validate Binary Search Tree
- js 生成随机炫彩背景
- H264--2--语法及结构
- HDU1800 字典树写法
- linux下直接复制文件内容到剪切板
- P1141 01迷宫 dfs连通块
- Oracle实体化视图
- js 常用事件
- IP判断 (字符串处理)
- NPOI row.Cells[i] 的坑
- Unity3D第一课之自转与公转
- CentOS7安装配置SonarQube
热门文章
- AD走圆弧走线
- Nginx、MySQL、PHP 编译安装
- Oracle学习笔记(2)
- flink和spark Streaming中的Back Pressure
- mysql 如何删除数据库中所有的表
- 基于图灵api的Python机器人
- SpringBoot项目 org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Jetty servlet container报错
- Scheduled定时任务器在Springboot中的使用
- UML-GRASP前5种模式
- 0CTF-2016-piapiapia-PHP反序列化长度变化尾部字符串逃逸