阿里云 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
阿里云 asp.net core nginx 单机部署的更多相关文章
- 阿里云 centos7 django + uWSGI+Nginx + python3 部署攻略
centos7+nginx+python3+django+uwsgi配置Django 项目部署 1.租的服务器(选择centos)的话,需要在阿里云后台控制台开放几个端口,克隆一下已开放的端口,t ...
- 部署Asp.net core & Nginx,通过nginx转发
部署Asp.net core & Nginx,通过nginx转发 CentOS 7 x64 1.vs2017 建立Asp.net core项目,并发布到目录 2.通过FTP工具,将程序copy ...
- asp.net core 从单机到集群
asp.net core 从单机到集群 Intro 这篇文章主要以我的活动室预约的项目作为示例,看一下一个 asp.net core 应用从单机应用到分布式应用需要做什么. 示例项目 活动室预约提供了 ...
- 腾讯云-ASP.NET Core+Mysql+Jexus+CDN上云实践
腾讯云-ASP.NET Core+Mysql+Jexus+CDN上云实践.md 开通腾讯云服务器和Mysql 知识点: ASP.NET Core和 Entity Framework Core的使用 L ...
- asp.net core 2.1 部署 centos7
asp.net core 2.1 部署 centos7 Kestrel 非常适合从 ASP.NET Core 提供动态内容. 但是,Web 服务功能不像服务器(如 IIS.Apache 或 Nginx ...
- ASP.NET Core托管和部署Linux实操演练手册
一.课程介绍 ASP.NET Core 是一种全新的跨平台开源 .NET 框架,能够在 IIS.Nginx.Apache.Docker 上进行托管或在自己的进程中进行自托管. 作为一个.NET Web ...
- ASP.NET Core使用TopShelf部署Windows服务
asp.net core很大的方便了跨平台的开发者,linux的开发者可以使用apache和nginx来做反向代理,windows上可以用IIS进行反向代理. 反向代理可以提供很多特性,固然很好.但是 ...
- ASP.NET Core开发-Docker部署运行
ASP.NET Core开发Docker部署,.NET Core支持Docker 部署运行.我们将ASP.NET Core 部署在Docker 上运行. 大家可能都见识过Docker ,今天我们就详细 ...
- ASP.NET Core 1.0 部署 HTTPS (.NET Framework 4.5.1)
var appInsights=window.appInsights||function(config){ function r(config){t[config]=function(){var i= ...
随机推荐
- QT设计
MFC是跨平台的一个界面开发的类库 框架是什么呢? 1.基础模块 2.机制交互(数据传输) 3.多种语言 QT core QT gui QT widget QT 1.基础模块 2.拓展模块 3.too ...
- Spring Boot2(002):手动创建第1个SpringBoot2简单应用——“HelloWorld” web 工程
备注:以下内容参考 springboot 官方文档 https://docs.spring.io/spring-boot/docs/2.1.5.RELEASE/reference/pdf/spring ...
- 覆盖.project
<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name ...
- bzoj 4247挂饰
背包????不会... #include<bits/stdc++.h> #define INF 0x7fffffff #define LL long long #define N 1000 ...
- JS页面校验
结构: 1.导入正则表达式校验包:https://blog.csdn.net/weixin_44718300/article/details/88726653 2.页面校验.HTML <!DOC ...
- HZNU-ACM寒假集训Day6小结 线性DP
线性DP 考虑一组硬币面值 1,5,11 给定W,求凑出W的最少硬币个数 我们记凑出n需要用到的最少硬币数量为f(n) 我们注意到了一个很棒的性质 : f(n)只与f(n-1) f(n-5) f( ...
- 吴裕雄--天生自然TensorFlow2教程:张量排序
import tensorflow as tf a = tf.random.shuffle(tf.range(5)) a tf.sort(a, direction='DESCENDING') # 返回 ...
- PAT Advanced 1030 Travel Plan (30) [Dijkstra算法 + DFS,最短路径,边权]
题目 A traveler's map gives the distances between cities along the highways, together with the cost of ...
- JDK源码阅读-------自学笔记(五)(浅析数组)
一.数组基础 1.定义和特点 数组也可以看做是对象,数组变量属于引用类型,数组中每个元素相当于该队形的成员变量,数组对象存储在堆中. 2.初始化数组 常用类初始化 // 整型初始化 int[] int ...
- 冒泡排序_python
def popdata(ls): for i in range(len(ls)): for j in range(i+1,len(ls)): if ls[i]>ls[j]: # tmp=ls[i ...