Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Nginx deploy DoNetCore to Aliyun?

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article focuses on "how Nginx deploys DoNetCore to Aliyun". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how Nginx deploys DoNetCore to Aliyun.

Basic environment configuration

Please buy your own domain name and server first.

Create an application instance based on CVM ecs, select the system image as ubuntu 16.04, connect remotely through ssh locally, and configure it.

Ssh

... sudo apt-get updatesudp apt-get upgradesudo apt-get autoremovesudo apt-get clean

Install and configure nginx

Sudo apt-get install nginxsudo service nginx startsudo 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; # destination of website files root / home/hippie/website/wwwroot; # website domain name 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;}}

Detect configuration and update

Sudo nginx-tsudo nginx-s reload

Install dotnetcore

Please refer to the latest installation instructions on the official website: .netcore download

Deployment proc

Open the visualstudio2017 right-click the project to be released, click publish, and refer to the following figure for related configuration.

Click the save button and perform the publish operation. Then upload the publish folder to the appropriate location on the server, and execute it after the upload is successful.

Dotnet run app.dll

If nothing happens, at this time, you can access it through ip or your website domain name.

Create a daemon

After doing the above, our program still can't run for a long time, so we need to manage our website through daemons.

Sudo apt-get install supervisorsudo vim / ect/supervisor/conf.d/website.conf

Configure the website.conf file

[program:website] # Command to be executed command=/usr/bin/dotnet attention.dll # directory executed by the command directory=/home/hippie/website # environment variable environment=aspnetcore__environment=production # user identity user=www-data stopsignal=int# executed by the process whether autostart=true# automatically restarts autorestart=true# automatic restart interval startsecs=1 # standard error log stdout _ logfile=/var/log/website.out.log

Sudo supervisorctl shutdown & & sudo supervisord-c / etc/supervisor/supervisord.confsupervisorctl shutdown sudo service supervisor start

Well, at this time, you can try to close the remote connection for website access, if you can access it normally, it means that your configuration has worked.

At this point, I believe you have a deeper understanding of "how Nginx deploys DoNetCore to Aliyun". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report