用到的软件如下

xshell,xftp,vs2017.3,centos 7.3 64位

安装环境

aliyun centos 7.3 64位

安装.net core 2.0 依赖的组件

yum install deltarpm epel-release unzip libunwind gettext libcurl-devel openssl-devel zlib libicu-devel

安装.net core 2.0

sudo dnf install libunwind libicu
curl -sSL -o dotnet.tar.gz https://aka.ms/dotnet-sdk-2.0.0-linux-x64
sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet
sudo ln -s /opt/dotnet/dotnet /usr/local/bin
dotnet --help

在命令 dotnet --help 看到下面信息就安装.net core 2.0成功了

[root@iZ6r8lfyydxll0Z ~]# dotnet --help
.NET Command Line Tools (2.0.0)
Usage: dotnet [runtime-options] [path-to-application]
Usage: dotnet [sdk-options] [command] [arguments] [command-options] path-to-application:
The path to an application .dll file to execute.

使用VS2017.3 新建一个.net core 2.0 的测试代码

使用xftp 把生成好的程序 (webcore/webcore/bin/Debug/netcoreapp2.0/publish下的文件)上传到 /home/test 目录下

安装配置nginx

yum install nginx

配置nginx.conf

server {

    listen 80;
server_name test.fun5.cn; location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
} error_page 404 /404.html;
location = /40x.html {
} error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}

配置守护进程安装Supervisor

yum install Supervisor

Supervisor配置文件,创建一个ini 配置文件 webcore.ini

[program:webcore]
command=dotnet webcore.dll
directory=/home/test
environment=ASPNETCORE__ENVIRONMENT=Production
user=root
stopsignal=INT
autostart=true
autorestart=true
startsecs=3
stderr_logfile=/var/log/webcore.err.log
stdout_logfile=/var/log/webcore.out.log

创建好之后,使用 xftp 上次到 /etc/supervisord.d 目录下

最后启动

supervisord -c /etc/supervisord.conf

执行 nginx -s reload

访问 nginx 绑定的域名可以看到网站可以跑起来了

到这里基本上就配置好了 nginx + linux + .net core 2.0


如果想要supervisord开机自启动

编辑启动文件

vi /etc/rc.local

在新行添加要执行的命令

supervisord  -c /etc/supervisord.conf

常用命令

查看所有action

 
supervisorctl help

控制所有进程

supervisorctl start all
supervisorctl stop all
supervisorctl restart all

控制目标进程

supervisorctl stop shadowsocks
supervisorctl start shadowsocks
supervisorctl restart shadowsocks

发布.net core到Centos7的更多相关文章

  1. .NET Core项目部署到Linux(Centos7)(六)发布.NET Core 项目到Linux

    目录 1.前言 2.环境和软件的准备 3.创建.NET Core API项目 4.VMware Workstation虚拟机及Centos 7安装 5.Centos 7安装.NET Core环境 6. ...

  2. 在离线环境中发布.NET Core至Windows Server 2008

    在离线环境中发布.NET Core至Windows Server 2008 0x00 写在开始 之前一篇博客中写了在离线环境中使用.NET Core,之后一边学习一边写了一些页面作为测试,现在打算发布 ...

  3. 重磅!!!微软发布.NET Core 2.2

    我们很高兴地宣布发布.NET Core 2.2.它包括对运行时的诊断改进,对ARM32 for Windows和Azure Active Directory for SQL Client的支持.此版本 ...

  4. List多个字段标识过滤 IIS发布.net core mvc web站点 ASP.NET Core 实战:构建带有版本控制的 API 接口 ASP.NET Core 实战:使用 ASP.NET Core Web API 和 Vue.js 搭建前后端分离项目 Using AutoFac

    List多个字段标识过滤 class Program{  public static void Main(string[] args) { List<T> list = new List& ...

  5. 使用 dotnet CLI 来打包和发布 .NET Core nuget package

    原文链接:使用 dotnet CLI 来打包和发布 .NET Core nuget package 如何使用 visual studio 2015/2017 打包和发布 Nuget package, ...

  6. 通过VS2017发布.net core程序并使用Web 部署到远程服务器最新教程

    最近一个项目中,为App开发后台接口,技术选型为最新 .net core版本,使用.net core开发web api接口过程中,为了方便app团队成员直接在线调用接口,找了公网上的一台服务器做为ap ...

  7. 【故障公告】发布 .NET Core 版博客站点引起大量 500 错误

    非常抱歉,今天上午的博客站点故障给大家带来了很大的麻烦,请大家谅解.这次故障是我们发布 .NET Core 版博客站点引起的,虽然我们进行了充分的准备,但还是低估了高并发下的复杂问题. 以下是故障背景 ...

  8. .NET Conf 2019 大会上发布.NET Core 3.0

    北京时间今天凌晨如期在.NET Conf 上发布.NET Core 3.0,Keynotes 由Scott Hunter 主演,主要围绕.NET Core 3.0的新特性和社区展开. 多功能性是.Ne ...

  9. Docker 简单发布dotnet core项目 图文版

    原文:https://www.cnblogs.com/chuankang/p/9474591.html docker发布dotnet core简单流程 需要结合这个版本看哈 地址:https://ww ...

随机推荐

  1. OSGI企业应用开发(十一)Bundle资源获取途径

    使用OSGI模块化标准构建Java EE项目,其中比较繁琐的一个方面就是Bundle资源的获取,因为很多开源框架官方都没有发布Bundle版本的Jar文件,这也是使用OSGI开发企业应用首先要解决的问 ...

  2. OSGI企业应用开发(八)整合Spring和Mybatis框架(一)

    到目前为止,我们已经学习了如何使用Blueprint將Spring框架整合到OSGI应用中,并学习了Blueprint&Gemini Blueprint的一些使用细节.本篇文章开始,我们將My ...

  3. JavaScript实现时间查询

    首先要引入js文件和css文件 <script src="jquery-1.11.2.min.js"></script> <script src=&q ...

  4. [Java] 用 Comparator 实现排序

    最近正好用到Comparator,发现能对不同类型的对象进行排序(当然排序依据还是基本类型),也不用自己实现排序算法,用起来很方便,所以简单记录一下. 本文地址:http://www.cnblogs. ...

  5. using 和try/catch区别和注意点

    书上解释: using: 在C#和其他托管语言中,没有自动.决定性的析构方式,而是有一个垃圾收集器,它会在未来的某个时刻释放资源.它是非决定性的,因为我们不能确定这个过程在什么时候发生.忘记关闭数据库 ...

  6. 对C#Chart控件使用整理

    转:https://blog.csdn.net/andrewniu/article/details/78770186 https://blog.csdn.net/andrewniu/article/d ...

  7. Jboss 4.2.3配置与优化

    1      Jboss内存优化 修改这个两参数,给jvm分配适当的内存,一般为服务器的3/4内存量,推荐至少使用4G内存. 另外添加两个参数 -XX:+UseParallelGC -XX:+UseP ...

  8. 转:queue

    数据结构C#版笔记--队列(Quene)   队列(Quene)的特征就是“先进先出”,队列把所有操作限制在"只能在线性结构的两端"进行,更具体一点:添加元素必须在线性表尾部进行, ...

  9. Linux之JDK1.8的安装

    这个最基础的,但是老是查了一次又查,干脆记起来吧. 一.下载jdk8 地址:http://www.oracle.com/technetwork/java/javase/downloads/index. ...

  10. 系统升级win7 sp1后,ado,MSJRO.tlh error 问题

    MSJRO.tlh() : error C2501: '_RecordsetPtr' : missing storage-class or type specifiers MSJRO.tlh() : ...