First of all, I am just a front-end, if there is anything not rigorous in the article, welcome to point out

I..net Core environment construction

# yum install libunwind libicu # libcu rely on
# wget https://download.microsoft.com/download/E/8/A/E8AF2EE0-5DDA-4420-A395-D1A50EEFD83E/dotnet-sdk-2.1.401-linux-x64.tar.gz  Here I chose 2.1.4. You can choose your own version
# mkdir -p /home/dotnet Create a directory
#Tar ZXF dotnet- sdK-2.1.401-linux-x64.tar. gz -c /home/dotnetUnzip the current SDK into the directory you just created
# cd /home/dotnet # Open the directory you just created
# ln -s /home/dotnet/dotnet /usr/local/bin The current directory is equivalent to adding desktop shortcuts under Win
# dotnet --info Install complete and check the SDK information
Copy the code

Nginx environment deployment

# curl -o  nginx.rpm http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm Usually I prefer the source code installation can install a lot of required modules here in order to quickly select the RPM way to install
# rpm -ivh nginx.rpm
# yum install nginx 
Copy the code

# vim /etc/nginx/conf.d/default.conf 
Copy the code

Change the configuration file reverse proxy to the default port 5000 of.NET Core

server { listen 80; Location / {proxy_pass http://localhost:5000; Proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection keep-alive; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; }}Copy the code

Start the nginx

# nginx -t 
# nginx -s reload
Copy the code

Configure the Supervisor

  • Installing and Configuring Supervisor
# yum install python-setuptools
# easy_install supervisor 
# mkdir /ect/supervisor Create a directory
# echo_supervisord_conf > /etc/supervisor/supervisord.conf  # config file
Copy the code
  • Configure the Supervisor
# mkdir /etc/supervisor
# echo_supervisord_conf > /etc/supervisor/supervisord.conf Initialize the configuration file

Copy the code
  • Then change the conf directory to remove the semicolon, or comment
[include]
files = conf.d/*.conf
Copy the code
  • Next is the directory to create the configuration file
# mkdir -p /etc/supervisor/conf.d
# vim dontNet.conf
Copy the code
  • Write the configuration file in
 [program:DotNet]
   command=dotnet Test.dll ; Directory =/home/wwwroot/DotNet/; Directory where the command is executed autorestart=true; Whether to automatically restart the program after it exits unexpectedly stderr_logfile=/var/log/DotNetCoreWeb.err.log ; Error logfile stdout_logfile=/var/log/DotNetCoreWeb.out.log ; Environment =ASPNETCORE_ENVIRONMENT=Production; Process environment variable user=root; Process execution user stopSignal =INTCopy the code
  • It is designed to run the container and is visible
supervisord -c /etc/supervisor/supervisord.conf
ps -ef | grep DotNet
Copy the code

That’s it