阿里云 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= ...
随机推荐
- bzoj 2306
%%%%http://blog.csdn.net/popoqqq/article/details/43926365 #include<bits/stdc++.h> #define INF ...
- Android Studio Madual作为application的使用以及工作空间和modual的区别
Android Studio Madual作为application的使用以及工作空间和modual的区别 前言: 写这篇文章的目的是因为自己使用Android Studio开发时进入了一个误区,后面 ...
- Swift - 从相册中选择视频(过滤掉照片,使用UIImagePickerController)
(本文代码已升级至Swift4) 有时我们需要从系统相册中选择视频录像,来进行编辑或者上传操作,这时使用 UIImagePickerController 就可以实现. 默认情况下,UIImagePic ...
- [题解] Luogu P2000 拯救世界
生成函数板子题...... 要写高精,还要NTT优化......异常dl 这个并不难想啊...... 一次召唤会涉及到\(10\)个因素,全部写出来,然后乘起来就得到了答案的生成函数,输出\(n\)次 ...
- 一个例子搞清楚Java程序执行顺序
当我们new一个GirlFriend时,我们都做了什么? 一个例子搞懂Java程序运行顺序 public class Girl { Person person = new Person("G ...
- CI中site_url()和base_url()的区别
CI中site_url()和base_url()的区别 来源:未知 时间:2014-10-20 11:38 阅读数:150 作者:xbdadmin [导读] 在使用CI框架的使用经常碰到 ...
- Windows如何设置指定的IP走专线?
很多时候在工作中难免有多重网络环境的情况,为了方便之间的互访,可能会用的VPN等虚拟专线,作为网络管理员,route命令是必会的基础技能. 我们一般连接到专线vpn以后,默认会启用远程网关,这样我们所 ...
- B - Common Divisors (codeforces)数论算法基本定理,唯一分解定理模板
You are given an array aa consisting of nn integers. Your task is to say the number of such positive ...
- IDEA抽取方法的快捷键
正常的话是 ctrl+alt+m 如果快捷键占用或者修改过,在写代码的地方右键->refactor->extract->method
- [极客大挑战 2019]BuyFlag
0x00 知识点 php中的strcmp漏洞 说明: int strcmp ( string $str1 , string $str2 ) 参数 str1第一个字符串.str2第二个字符串.如果 st ...