centos 7 && dotnet core 2.0 && nginx && supervisor_.NET_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > .NET > centos 7 && dotnet core 2.0 && nginx && supervisor

centos 7 && dotnet core 2.0 && nginx && supervisor

 2017/9/15 3:26:55  wuball  程序员俱乐部  我要评论(0)
  • 摘要:前提系统:centos7目录:/home/wwwroot/www.wuball.comdotnetcore2.0官方指引sudorpm--importhttps://packages.microsoft.com/keys/microsoft.ascsudosh-c'echo-e"[packages-microsoft-com-prod]\nname=packages-microsoft-com-prod\nbaseurl=https://packages.microsoft
  • 标签:net Nginx CentOS

前提


系统:centos 7

目录:/home/wwwroot/www.wuball.com

dotnet core 2.0


官方指引

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

sudo sh -c 'echo -e "[packages-microsoft-com-prod]\nname=packages-microsoft-com-prod \nbaseurl=https://packages.microsoft.com/yumrepos/microsoft-rhel7.3-prod\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/dotnetdev.repo'

sudo yum update

sudo yum install libunwind libicu

sudo yum install dotnet-sdk-2.0.0

nginx


安装启用

yum install nginx

systemctl start nginx

systemctl enable nginx

配置

vi /etc/nginx/conf.d/www.wuball.com.conf

添加以下内容

server {

listen 80;

server_name www.wuball.com;

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;

}

}

 

重载

sudo nginx -s reload

开启 http/https 防火墙端口

sudo firewall-cmd --permanent --add-port=80/tcp

sudo firewall-cmd --permanent --add-port=443/tcp

sudo firewall-cmd --reload

 

supervisor


安装

yum install python-setuptools

easy_install supervisor

mkdir -m 755 -p /etc/supervisor

echo_supervisord_conf > /etc/supervisor/supervisord.conf

cd /etc/supervisor/

mkdir -m 755 conf.d

修改配置

vi /etc/supervisor/supervisord.conf

[include]

files = conf.d/*.ini

配置守护

vi /etc/supervisor/conf.d/www.wuball.com.ini

添加以下内容

[program:www.wuball.com]

command=/bin/bash -c "cd /home/wwwroot/www.wuball.com && dotnet Project.Wuball.dll"

directory=/home/wwwroot/www.wuball.com

autostart=true

autorestart=true

stderr_logfile=varlog www.wuball.com.err.log

stdout_logfile=varlog www.wuball.com.out.log

environment=ASPNETCORE_ENVIRONMENT=Production

user=root

stopsignal=INT

启动守护

supervisord -c /etc/supervisor/supervisord.conf

常用命令

supervisorctl start program_name

supervisorctl reload

完成


访问 www.wuball.com (示例)

 

上一篇: ASP.Net MVC中的@与<% %> 下一篇: 没有下一篇了!
发表评论
用户名: 匿名