[原创]Centos7 安装配置ASP.NET Core+Nginx+Supervisor
序言
此教程安装的都是最新版本的。
一键安装
有了这个神器,下面的教程就不用做了!只需运行几行代码,直接打开浏览器就可以访问!
cd /home/
wget https://files.cnblogs.com/files/project/install.sh
chmod install.sh
./install.sh
准备工作
1. 更新系统
没啥,就他喵想用个最新的。
apt update && apt upgrade
2. 创建目录
创建目录,分别用来放配置文件和网站。
mkdir /web/
一、ASP.NET Core
官方网站:https://docs.microsoft.com/zh-cn/dotnet/core/install/linux-package-manager-debian10
1. 注册Microsoft密钥和订阅源
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg
sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
wget -q https://packages.microsoft.com/config/debian/10/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg
sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list
2. 安装.NET Core SDK
sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-3.1
3. 利用.NET Core SDK创建一个web实例
创建 Web 应用项目
cd /web/
dotnet new webapp -o app
二、Supervisor
官方网站:http://www.supervisord.org/
1. 安装Supervisor
apt install -y supervisor
2. 编辑supervisord.conf
vim /etc/supervisor/supervisord.conf
3. 新建配置文件
将下面配置文件存到/etc/supervisor/conf.d/app.conf
[program:app]
command=dotnet run ;要执行的命令
directory=/web/app/ ;命令执行的目录
autostart=true ;是否自动启动
autorestart=true ;是否自动重启
stderr_logfile=/var/log/webapp.err.log ;标准错误日志
stdout_logfile=/var/log/webapp.out.log ;标准输出日志
4. 重新启动
supervisorctl shutdown
supervisord -c /etc/supervisor/supervisord.conf
四、Nginx
官方网站:http://nginx.org/
1. 安装nginx
apt install -y nginx
2. 编辑nginx.conf
vim /etc/nginx/nginx.conf
3. 修改如下
worker_processes ;
events {
worker_connections ;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout ;
gzip on;
server {
listen ;
server_name localhost;
location / {
proxy_pass https://localhost:5001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache_bypass $http_upgrade;
}
}
}
4. 重新加载
nginx -s reload
五、效果预览

附、常用命令
nginx
# nginx //启动nginx
# nginx -s reload //重启nginx
# nginx -s stop //关闭nginx
supervisor
supervisord
supervisorctl status //查看所有任务状态
supervisorctl shutdown //关闭所有任务
supervisorctl start|stop|restart all //控制所有进程
supervisorctl start|stop|restart program_name //控制目标进程
[原创]Centos7 安装配置ASP.NET Core+Nginx+Supervisor的更多相关文章
- CentOS7上部署ASP.Net Core 2.2应用
前言 在CentOS7上部署ASP.Net Core应用是我的技术路线验证的一部分,下一个产品计划采用ASP.Net Boilerplate Framework开发.因此需要求提前进行一下技术验证,在 ...
- 部署Asp.net core & Nginx,通过nginx转发
部署Asp.net core & Nginx,通过nginx转发 CentOS 7 x64 1.vs2017 建立Asp.net core项目,并发布到目录 2.通过FTP工具,将程序copy ...
- 本文演示如何配置ASP.NET Core项目以在Visual Studio(VS)2017中使用Telerik UI for ASP.NET Core。
学习时使用的是VS2017+Core2.1了,不再讨论VS2015和core1.1的东西. 配置ASP.NET Core Web应用程序以使用Telerik UI for ASP.NET Core: ...
- ASP.NET Core Identity 配置 - ASP.NET Core 基础教程 - 简单教程,简单编程
原文:ASP.NET Core Identity 配置 - ASP.NET Core 基础教程 - 简单教程,简单编程 ASP.NET Core Identity 配置 上一章节我们简单介绍了下 Id ...
- ASP.NET Core macOS 环境配置 - ASP.NET Core 基础教程 - 简单教程,简单编程
原文:ASP.NET Core macOS 环境配置 - ASP.NET Core 基础教程 - 简单教程,简单编程 ASP.NET Core 是对 ASP.NET 有重大意义的一次重新设计.本章节我 ...
- ASP.NET Core Windows 环境配置 - ASP.NET Core 基础教程 - 简单教程,简单编程
原文:ASP.NET Core Windows 环境配置 - ASP.NET Core 基础教程 - 简单教程,简单编程 ASP.NET Core Windows 环境配置 ASP.NET Core ...
- CentOS7 安装配置笔记
CentOS7 安装配置笔记 1.通过镜像安装 CentOS7 ==============================* 使用 UltraISO 9.7 或者 rufus-3.5p 制作ISO的 ...
- 用"hosting.json"配置ASP.NET Core站点的Hosting环境
通常我们在 Prgram.cs 中使用硬编码的方式配置 ASP.NET Core 站点的 Hosting 环境,最常用的就是 .UseUrls() . public class Program { p ...
- 阿里云服务器Linux CentOS安装配置(八)nginx安装、配置、域名绑定
阿里云服务器Linux CentOS安装配置(八)nginx安装.配置.域名绑定 1.安装nginx yum -y install nginx 2.启动nginx service nginx star ...
随机推荐
- php http 缓存(客户端缓存)
<?php /* * Expires:过期时间 * Cache-Control: 响应头信息 * (max-age:[秒]缓存过期时间(请求时间开始到过期时间的秒数), * s-maxage:[ ...
- 取石子游戏 BZOJ1874 博弈
小H和小Z正在玩一个取石子游戏. 取石子游戏的规则是这样的,每个人每次可以从一堆石子中取出若干个石子, 每次取石子的个数有限制,谁不能取石子时就会输掉游戏. 小H先进行操作,他想问你他是否有必胜策略, ...
- 对DeepLung数据预处理部分的详细展示
之前有解释预处理部分的函数,不过觉得还不够详细,同时文字解释还不够直观,所以现在想一步步运行下,打印输出 首先读取原始数据,包括相应的注释(即结节标签)[注意]注释文件中的标签是按x,y,z的顺序给的 ...
- pytorch 迁移学习[摘自官网]
迁移学习包含两种:微调和特征提取器. 微调:对整个网络进行训练,更新所有参数 特征提取器:只对最后的输出层训练,其他层的权重保持不变 当然,二者的共性就是需要加载训练好的权重,比如在ImageNet上 ...
- MySql8最新配置方式(完美)
下载MYSQL8 地址:https://www.mysql.com/downloads/ 1.滑动网页到最下面,选择Community (GPL) Downloads » 2.选择MySQL Comm ...
- Redis学习笔记(2)—— Redis的安装和使用
一.CentOS安装Redis 1.1 安装环境 redis是C语言开发的,安装redis需要先将官网下载的源码进行编译,编译依赖gcc环境.如果没有gcc环境,需要安装gcc: yum instal ...
- form组件之modelForm
modelForm的使用及参数设置 从modelForm这个名字就能看出来,这个form是和模型类model有知己诶关联的,还是以数和出版社的模型来说明: models.py(模型) from dja ...
- Spring Cloud 监控相关
因为最近客户提出想监控Spring Cloud运行状况的需求,所以稍稍做了调研.目前了解的方法如下: Eureka Server启动后可以在根目录路径看到所有注册的Eureka Client状况 各个 ...
- 【Effective Java】阅读
Java写了很多年,很惭愧,直到最近才读了这本经典之作<Effective Java>,按自己的理解总结下,有些可能还不够深刻 一.Creating and Destroying Obje ...
- HIVE sql取中文
select regexp_replace(str,'[^\\u4e00-\\u9fa5]','') as str1 from ( select 'test测试test' as str ) t ;