Basic environment configuration Please purchase the domain name and server by yourself first Create an application instance based on the cloud server ECS, select the system image as Ubuntu 16.04, connect remotely via SSH on the local machine, and perform relevant configurations ... sudo apt-get update sudp apt-get upgrade sudo apt-get autoremove sudo apt-get clean Install and configure Nginx sudo apt-get install nginx sudo service nginx start sudo gedit /etc/nginx/sites-available/default Configure the default file and configure the following node information at the end of the file # Virtual Host configuration for example.com # # You can move that to a different file under sites-available/ and symlink that # to sites-enabled/ to enable it. # server { listen 80; # The target location of the website files is root /home/hippie/website/wwwroot; # server_name your website name; 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; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } Check configuration and update sudo nginx -t sudo nginx -s reload Install DotNetCore Please refer to the latest installation instructions on the official website: .NetCore Download Deployment Process Open VisualStudio2017, right-click the project to be published, click Publish, and refer to the figure below for relevant configuration. Click the Save button to publish. Then upload the publish folder to the corresponding location on the server. After the upload is successful, execute If nothing goes wrong, at this time, you can access it through IP or your website domain name. Creating a daemon process After performing the above operations, our program still cannot run for a long time, so we need to manage our website through a daemon process sudo apt-get install supervisor sudo vim /ect/supervisor/conf.d/website.conf Configure website.conf file [program:website] #Command to execute command=/usr/bin/dotnet Attention.dll #Command execution directory directory=/home/hippie/website #Environment variable environment=ASPNETCORE__ENVIRONMENT=Production #Process execution user identity user=www-data stopsignal=INT #Whether to start automatically autostart=true #Whether to automatically restart autorestart=true #Automatic restart interval startsecs=1 #Standard error log stderr_logfile=/var/log/website.err.log #Standard output log stdout_logfile=/var/log/website.out.log At this time, we execute the following command to start the daemon process sudo supervisorctl shutdown && sudo supervisord -c /etc/supervisor/supervisord.conf supervisorctl shutdown sudo service supervisor start Well, now you can try to close the remote connection to access the website. If you can access it normally, it means that your configuration has worked. Summarize The above is the installation and configuration method that I introduced to you for deploying DoNetCore to Alibaba Cloud in combination with Nginx. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time! You may also be interested in:
|
<<: Solve the problem that await does not work in forEach
>>: MySQL trigger detailed explanation and simple example
The following operation demonstrations are all ba...
In this article, we’ll explore how async/await is...
In the actual project development process, the pag...
Look at the code first Copy code The code is as fo...
Download CentOS7 The image I downloaded is CentOS...
Table of contents Jenkins installation Install Ch...
1. Create a docker network card [root@i ~]# brctl...
Table of contents 1. Filter unique values 2. Shor...
react.js framework Redux https://github.com/react...
Table of contents Overview Same Origin Policy (SO...
Copy code The code is as follows: <div class=&...
On CentOS 7, when we map the host port to the con...
Install Follow the README to install The document...
I finished reading "Patterns for Sign Up &...
BMP is an image file format that is independent o...