阿里云 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= ...
随机推荐
- PrepareStatement对象进行批处理的典型步骤顺序
https://www.yiibai.com/jdbc/preparestatement-batching-example.html 以下是使用PrepareStatement对象进行批处理的典型步骤 ...
- localStorage中使用json
function setLocalJson(name, json) { json = JSON.stringify(json); localStorage.setItem(name, json)} f ...
- 安装postgresql后找不到服务 postgresql service
问题再现 环境: postgresql: 11.5 windows 10 企业版LTSC 64位 使用postgresql-11.5-1-windows-x64.exe安装后,让重新启动,但是重启后, ...
- 洛谷 P1968 美元汇率
题目传送门 解题思路: 一道很简单的DP AC代码: #include<iostream> #include<cstdio> using namespace std; int ...
- dac FDMemTable
unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System ...
- hook截获自定义消息
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...
- 2019年Unity3D游戏开发前景预测及总结
由于现在随着互联网时代的到来,人们上网玩游戏的越来越多,导致游戏开发人才供不应求,如果你想成为一名优秀的开发者,那么掌握Unity3D开发技术是不可跳过的一环.随着移动互联网的发展,移动端游戏日益盛行 ...
- JAVA课程设计——俄罗斯方块
0.负责模块为可视化界面,技术栈为 (1)异常处理 (2)多线程 (3)文件存储 (4)Java swing 1.登陆界面 我的代码 import java.awt.Color; import jav ...
- TypeError: TF_SessionRun_wrapper: expected all values in input dict to be ndarray.
在用Embedding时出现了这个问题,具体的代码: model.add(Embedding(input_dim = vocab_size, output_dim = embedding_vector ...
- C++对象数组与对象指针
(一)对象数组 将具有相同类类型的对象有序地集合在一起便构成了对象数组,以一维对象数组为例,其定义形式为: 类名 对象数组名[]; Point points[100]; 关于对象数组的几点说明: (1 ...