In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about how to deploy the .net core site in nginx. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.
Steps
The aspnetcore program port number 5001, the actual external port number 8001, is equivalent to forwarding the request received by 8001 to 5001.
Throw out all the published files and go inside / var/www/JuXiangTou. You can use the scp command or winscp client
Centos 7.x
The running environment of aspnet core does not need to be installed with sdk. Generally speaking, sdk contains runtime.
Yum install libunwind libicuyum install aspnetcore-runtime-2.1
Nginx, a reverse proxy service, forwards incoming http requests to the actual aspnetcore processing
Sudo yum install epel-releasesudo yum install nginxsudo systemctl start nginxsudo systemctl enable nginx
Install the nginx to configure the port and so on.
Cd / etc/nginx/
Nginx.conf is the default configuration file and is basically untouched.
Cd conf.dvim kestrel-juxiangtou.conf
The following is mainly that the two port numbers need to be changed, and the rest can not be changed.
Server {listen 8001; location / {proxy_pass http://localhost:5001; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection keep-alive; proxy_set_header Host $http_host; proxy_cache_bypass $http_upgrade;}}
Save exit
Verify the configuration, and then reload
Sudo nginx-t sudo nginx-s reload
Firewall firewall-cmd. It doesn't have to be installed, it depends on the environment.
Systemctl status firewalldfirewall-cmd-zone=public-add-port=8001/tcp-permanentfirewall-cmd-reloadsystemctl restart firewalld.service
Build a service to maintain the program process of dotnetcore
Cd / etc/systemd/systemvim kestrel- juxiangtou.service[Unit] Description= JuXiangTou[Service] WorkingDirectory=/var/www/JuXiangTouExecStart=/usr/bin/dotnet / var/www/JuXiangTou/Site.WebApi.dllRestart=alwaysRestartSec=10SyslogIdentifier=JuXiangTouUser=rootEnvironment=ASPNETCORE_ENVIRONMENT= Production[Install] WantedBy=multi-user.target
Save exit
After reading the above content in systemctl restart kestrel-juxiangtou.service, do you have any further understanding of how to deploy a. Net core site in nginx? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.