This blog post references the following articles:
1, http://www.cnblogs.com/ants/p/5732337.html
2, http://www.linuxidc.com/Linux/2016-11/137010.htm
broadly similar, just encountered some problems during the release and made some records. Other people may encounter different problems, and can refer to two other articles .
Configuration:
- Server: CENTOS7 (Hyper virtual machine)
- Related tools: WinSCP (FTP tool), PuTTY
- Development tools: vs2017
- Related software: Nginx, supervisor
Overview:
Please note that the time of the blog release, is now the 1.0 version of ASP. On Linux, Microsoft officially recommended Nginx as a Web server, monitoring 80 ports, and then forwarded to the ASP. ASP. NET core site with supervisor Guardian.
Get ready:
VS2017 Create a new empty ASP. NET Core project, and then publish the project as a file system to make sure that everything is working properly locally.
First step: Install the centos,.net Core SDK
- Installing CentOS
- install. NET Core sdk
The installation of this SDK is successful!!
Step two: Upload ASP. NET Core
- Upload files to/home/yin/wwwroot/with WINSCP.
- Execute under the Wwwroot folder:
Dotnet Demoweb.dll
Note that the assembly name is replaced by its own local assembly name
- Step Three: Configure Nginx
- Install Nginx using Source installation method
- : https://nginx.org/download/nginx-1.12.0.tar.gz Note that the corresponding version number is selected when downloading
- Execute the following command
TAR-ZXVF nginx-1.12.0.tar.gz
CD nginx-1.12.0
./Configuremakesudomakeinstall
Note if the./configure fails, most are not installed by the compile tool, which executes:
Yum Install Make gcc-c++ libtool OpenSSL openssl-devel
The Nginx execution path is added to the PATH environment variable, and the Nginx directory should be avoided every time the nginx is started.
VI ~/.BASHRC
Add to
Export path="/usr/local/nginx/sbin: $PATH"
Then enter the following command to apply:
SOURCE ~/.BASHRC
To modify the Nginx configuration file:
VI /usr/local/nginx/conf/nginx.conf
The configuration is as follows:
server { a; / { proxy_pass http://localhost:5000; 1.1 ; Proxy_set_header Upgrade $http _upgrade; Proxy_set_header Connection Keep-alive; Proxy_set_header Host $host; Proxy_cache_bypass $http _upgrade; }}
Restart Nginx:
Nginx-s Reload
Open port number (Administrator action):
Firewall-cmd--zone=public--add-port=/tcp-permanentsystemctl restartfirewalld
Perform:
Dotnet/home/yin/wwwroot/demoweb.dll
Here you can access the ^.^
Fourth Step: Install Supervisor
We need to monitor the operation of the ASP. We need to install supervisor in order to solve this problem if an exception is required to restart automatically.
- Download the source code: https://pypi.python.org/packages/7b/17/88adf8cb25f80e2bc0d18e094fcd7ab300632ea00b601cbbbb84c2419eae/ Supervisor-3.3.2.tar.gz
- Upload to Server, execute command:
tar zxvf supervisor-3.3. 2. Tar . GZCD Supervisor-3.3. 2 sudo Install
- During installation, you may be prompted to: meld3>=0.6.5 error
- Workaround:
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/p/python-meld3-0.6.10-1.el7.x86_ 64.rpmsudo rpm-ivh python-meld3-0.6. 1. el7.x86_64.rpm
Configuration Supervisor:
mkdir /etc/>/etc/supervisor/supervisord.conf
Modify Supervisord.conf:
VI /etc/supervisor/supervisord.conf
Add the following content:
= CONF.D/*. conf
Create configuration file demoweb.conf:
mkdir CONF.D VI demoweb.conf
Add the following content:
[Program:demoweb]command=dotnet demoweb.dll directory=/home/yin/wwwroot/autorestart= true stderr_logfile=/var/log/demoweb.err.logstdout_logfile=/var/log/ Demoweb.out.logenvironment=aspnetcore_environment=Production User=root stopsignal=int
Run Supervisor:
Supervisord-c/etc/supervisor/supervisord.conf
To this big announcement into!! Access address
ASP. NET Core Linux Publishing