{"id":443974,"date":"2025-01-02T21:01:20","date_gmt":"2025-01-02T21:01:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=443974"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2025-01-02T21:01:20","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=443974","title":{"rendered":"<span>\u0414\u0435\u043f\u043b\u043e\u0439\u043c\u0435\u043d\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 ASP.Net Core-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 VPS \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043d\u0438\u043c \u043f\u043e \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u043c\u0443 \u0438\u043c\u0435\u043d\u0438 3-\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h3>\n<ol>\n<li>\n<p>VPS-\u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Ubuntu 22.04.05 LTS.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430 VPS \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b: <\/p>\n<ul>\n<li>\n<p>nginx 1.18.0 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0435\u0432\u0435\u0440\u0441-\u043f\u0440\u043e\u043a\u0441\u0438.<\/p>\n<\/li>\n<li>\n<p>.Net \u043d\u0443\u0436\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u043e \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0430\u0439\u0442\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 VPS \u0432\u0435\u0434\u0435\u043c \u0438\u0437 \u043f\u043e\u0434 \u041e\u0421 Windows 10&#215;64 Professional.<\/p>\n<\/li>\n<\/ol>\n<h3>\u0426\u0435\u043b\u044c<\/h3>\n<ol>\n<li>\n<p>\u0417\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e ASP.Net Core \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c VPS.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u0436\u0434\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443: http:\/\/\u043f\u043e\u0434\u0434\u043e\u043c\u0435\u043d_\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.\u0434\u043e\u043c\u0435\u043d.<\/p>\n<\/li>\n<\/ol>\n<h3>1. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u0434\u0434\u043e\u043c\u0435\u043d (\u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 masterhost.ru)<\/h3>\n<p> \u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 DNS <code>https:\/\/cp.masterhost.ru\/dns<\/code> \u0438 \u043f\u043e\u0433\u043d\u0430\u043b\u0438! <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/994\/495\/5f6\/9944955f6f494b6f3d8362f06dc5c50a.jpg\" width=\"839\" height=\"877\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/994\/495\/5f6\/9944955f6f494b6f3d8362f06dc5c50a.jpg\" data-blurred=\"true\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/58b\/55f\/256\/58b55f256d85cb6d7352a1491f74ce1d.jpg\" width=\"1159\" height=\"974\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/58b\/55f\/256\/58b55f256d85cb6d7352a1491f74ce1d.jpg\" data-blurred=\"true\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/3f7\/8c7\/aef\/3f78c7aef9368d5fc23900addbd33a30.jpg\" width=\"1037\" height=\"974\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3f7\/8c7\/aef\/3f78c7aef9368d5fc23900addbd33a30.jpg\" data-blurred=\"true\"\/><\/figure>\n<h3>2. \u041f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h3>\n<p><code>dotnet publish -r linux-x64<\/code><\/p>\n<h3>3. \u0417\u0430\u0434\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u0442<\/h3>\n<p> \u0422\u0430\u043a \u043a\u0430\u043a \u0443 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 (\u0441\u0435\u0442\u0435\u0432\u044b\u0435) \u043f\u043e\u0440\u0442\u044b, \u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u0441\u0435 ASP.Net Core \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0430 5000 \u043f\u043e\u0440\u0442\u0443, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412 \u043f\u0430\u043f\u043a\u0435 publish \u043d\u0430\u0445\u043e\u0434\u0438\u043c <code>appsettings.json<\/code>. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/8cd\/faf\/9ce\/8cdfaf9cea36e074474362d26d3e7d2d.jpg\" width=\"1130\" height=\"358\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8cd\/faf\/9ce\/8cdfaf9cea36e074474362d26d3e7d2d.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b &#171;Kestrel&#187; \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438:<\/p>\n<pre><code> \"Kestrel\": {     \"Endpoints\": {       \"Http\": {         \"Url\": \"http:\/\/localhost:5005\" \/\/ Change this to your desired port       }     }   }<\/code><\/pre>\n<p> \u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b <code>appsettings.json<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a: <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/333\/5b1\/d5a\/3335b1d5a25ffb30ffecafa0949f981f.jpg\" width=\"1228\" height=\"455\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/333\/5b1\/d5a\/3335b1d5a25ffb30ffecafa0949f981f.jpg\" data-blurred=\"true\"\/><\/figure>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f ,\u0447\u0442\u043e \u043e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u043f\u043e\u0440\u0442\u0443 5005. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/562\/9d2\/364\/5629d23642ec97a2363a9317dec3617c.jpg\" width=\"872\" height=\"323\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/562\/9d2\/364\/5629d23642ec97a2363a9317dec3617c.jpg\" data-blurred=\"true\"\/><\/figure>\n<p> \u0418 \u044d\u0442\u043e \u0434\u0430\u0436\u0435 \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043f\u043e\u0434 \u041e\u0421 Windows 10&#215;64 Professional, \u0430 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b\u0438 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0434 Linux. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/198\/1f8\/84e\/1981f884ef2a5a7fc24342e0d29d3e22.jpg\" width=\"857\" height=\"410\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/198\/1f8\/84e\/1981f884ef2a5a7fc24342e0d29d3e22.jpg\" data-blurred=\"true\"\/><\/figure>\n<h3>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 VPS<\/h3>\n<p> \u041b\u044e\u0431\u044b\u043c \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c (\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e FileZilla, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0441\u044c \u043f\u043e SFTP \u0438 \u043f\u0435\u0440\u0435\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u043f\u0438\u0440\u0443\u044e \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 \u0432 \u0434\u0440\u0443\u0433\u0443\u044e) \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u0441 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u043c ASP.Net Core \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <code>\/var\/www<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u044f \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0441\u043e\u0437\u0434\u0430\u043b \u043f\u043e\u0434\u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/64d\/0eb\/9a0\/64d0eb9a0e0d2db341c06055629f4994.png\" width=\"1024\" height=\"583\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/64d\/0eb\/9a0\/64d0eb9a0e0d2db341c06055629f4994.png\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/203\/da9\/568\/203da9568732cd08fa2c1ac168bd47af.jpg\" width=\"1000\" height=\"565\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/203\/da9\/568\/203da9568732cd08fa2c1ac168bd47af.jpg\" data-blurred=\"true\"\/><\/figure>\n<h3>5. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 VPS<\/h3>\n<p> \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0441 \u043d\u0430\u0448\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c (TestRazor.dll) <\/p>\n<pre><code>cd \/var\/www\/TestRazor\/publish\/<\/code><\/pre>\n<p> \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0435\u0433\u043e <\/p>\n<pre><code> dotnet TestRazor.dll<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/f5e\/216\/e83\/f5e216e83dd9637cf47040a5b264ac4d.jpg\" alt=\"\u0412\u0441\u0451 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442!\" title=\"\u0412\u0441\u0451 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442!\" width=\"739\" height=\"227\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f5e\/216\/e83\/f5e216e83dd9637cf47040a5b264ac4d.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u0412\u0441\u0451 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442!<\/figcaption><\/div>\n<\/figure>\n<h3>6. \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c nginx<\/h3>\n<p> 1. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b <code>test-razor.config<\/code> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f: <\/p>\n<pre><code>server {         listen 80;         listen 443;         server_name test.s****ov.ru;          location \/ {         proxy_pass         http:\/\/127.0.0.1:5005;         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;         }     }<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <strong>server_name <\/strong>(4 \u0441\u0442\u0440\u043e\u043a\u0430). \u041d\u0430\u043f\u0440\u043e\u0442\u0438\u0432 \u043d\u0435\u0433\u043e \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <strong>\u0441\u0432\u043e\u0439_\u043f\u043e\u0434\u0434\u043e\u043c\u0435\u043d.\u0441\u0432\u043e\u0439_\u0434\u043e\u043c\u0435\u043d;<\/strong><\/p>\n<p> 2. \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c <code>test-razor.config<\/code>\u043d\u0430 VPS \u043f\u043e \u043f\u0443\u0442\u0438: <code>\/etc\/nginx\/sites-available<\/code>. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3eb\/5b7\/380\/3eb5b73805b9a35d71fc70cbeb700f15.png\" width=\"1047\" height=\"543\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3eb\/5b7\/380\/3eb5b73805b9a35d71fc70cbeb700f15.png\"\/><\/figure>\n<p> 3. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 <code>test-razor.config<\/code><\/p>\n<pre><code>sudo ln -s \/etc\/nginx\/sites-available\/test-razor.config \/etc\/nginx\/sites-enabled\/<\/code><\/pre>\n<p> 4. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e. <\/p>\n<pre><code>sudo nginx -t<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/40e\/0a9\/728\/40e0a9728739e51451fff762d2751969.jpg\" alt=\"\u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e!\" title=\"\u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e!\" width=\"752\" height=\"68\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/40e\/0a9\/728\/40e0a9728739e51451fff762d2751969.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e!<\/figcaption><\/div>\n<\/figure>\n<p> 5. \u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c nginx. <\/p>\n<pre><code>sudo systemctl restart nginx<\/code><\/pre>\n<p> \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c nginx \u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <code>\/etc\/nginx\/sites-enabled<\/code> \u043d\u0430 \u043f\u0440\u0435\u0434\u043c\u0435\u0442 \u043a\u0440\u0438\u0432\u044b\u0445\/\u043b\u0435\u0432\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0441\u044b\u043b\u043e\u043a \u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u0435 \u0442\u0430\u043a\u043e\u0432\u044b\u0435, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0435\u0441\u0442\u044c. <\/p>\n<h3>7. \u041e\u0444\u043e\u0440\u043c\u043b\u044f\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043b\u0443\u0436\u0431\u044b (\u0441\u043e\u0437\u0434\u0430\u0435\u043c Unit)<\/h3>\n<p> \u041d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b <code>test_razor.service<\/code> \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e: <\/p>\n<pre><code>[Unit] Description= \u0422\u0435\u0441\u0442\u043e\u0432\u043e\u0435 ASP.Net Core \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435  [Service] WorkingDirectory=\/var\/www\/TestRazor\/publish ExecStart=\/usr\/bin\/dotnet \/var\/www\/TestRazor\/publish\/TestRazor.dll Restart=always # Restart service after 10 seconds if the dotnet service crashes: RestartSec=10 KillSignal=SIGINT SyslogIdentifier=Raven User=root Environment=ASPNETCORE_ENVIRONMENT=Production Environment=DOTNET_NOLOGO=true [Install] WantedBy=multi-user.target<\/code><\/pre>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0449\u0430\u0435\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0443\u0442\u0435\u0439, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 <strong>WorkingDirectory<\/strong> \u0438 <strong>ExecStart<\/strong><\/p>\n<\/blockquote>\n<p> \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0435\u0433\u043e. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/070\/6a2\/4b3\/0706a24b398a1892950383bd3230a5e7.jpg\" width=\"1111\" height=\"513\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/070\/6a2\/4b3\/0706a24b398a1892950383bd3230a5e7.jpg\" data-blurred=\"true\"\/><\/figure>\n<p> \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c <code>test_razor.service<\/code> \u043d\u0430 VPS \u043f\u043e \u043f\u0443\u0442\u0438 \u043f\u043e \u043f\u0443\u0442\u0438 <code>\/etc\/systemd\/system<\/code> <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/ba7\/da8\/6f0\/ba7da86f0c8711db54a015f139477c4c.jpg\" width=\"889\" height=\"547\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ba7\/da8\/6f0\/ba7da86f0c8711db54a015f139477c4c.jpg\" data-blurred=\"true\"\/><\/figure>\n<p> \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0441\u043b\u0443\u0436\u0431\u044b.<\/p>\n<pre><code>systemctl start test_razor.service systemctl status test_razor.service<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/b1d\/309\/adf\/b1d309adf2a9a493b646fb2a80b18c16.jpg\" width=\"932\" height=\"355\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b1d\/309\/adf\/b1d309adf2a9a493b646fb2a80b18c16.jpg\" data-blurred=\"true\"\/><\/figure>\n<h3>8. \u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u043f\u043e url<\/h3>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/84c\/b92\/daa\/84cb92daa905ec13952c83301b347283.jpg\" width=\"852\" height=\"528\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/84c\/b92\/daa\/84cb92daa905ec13952c83301b347283.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u041d\u0443, \u0432\u043e\u0442 \u0432 \u043e\u0431\u0449\u0435\u043c-\u0442\u043e \u0438 \u0432\u0441\u0451. \u041f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u044f \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0442\u044c \u0435\u043c\u0443 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u0442 \u0438 \u0441\u0432\u043e\u0439 \u043f\u043e\u0434\u0434\u043e\u043c\u0435\u043d. \u0412\u0441\u0435\u043c \u0443\u0434\u0430\u0447\u0438! \u0416\u0434\u0443 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043f\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0435\u0439.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/871182\/\"> https:\/\/habr.com\/ru\/articles\/871182\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h3>\n<ol>\n<li>\n<p>VPS-\u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Ubuntu 22.04.05 LTS.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430 VPS \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b: <\/p>\n<ul>\n<li>\n<p>nginx 1.18.0 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0435\u0432\u0435\u0440\u0441-\u043f\u0440\u043e\u043a\u0441\u0438.<\/p>\n<\/li>\n<li>\n<p>.Net \u043d\u0443\u0436\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u043e \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0430\u0439\u0442\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 VPS \u0432\u0435\u0434\u0435\u043c \u0438\u0437 \u043f\u043e\u0434 \u041e\u0421 Windows 10&#215;64 Professional.<\/p>\n<\/li>\n<\/ol>\n<h3>\u0426\u0435\u043b\u044c<\/h3>\n<ol>\n<li>\n<p>\u0417\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e ASP.Net Core \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c VPS.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u0436\u0434\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443: http:\/\/\u043f\u043e\u0434\u0434\u043e\u043c\u0435\u043d_\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.\u0434\u043e\u043c\u0435\u043d.<\/p>\n<\/li>\n<\/ol>\n<h3>1. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u0434\u0434\u043e\u043c\u0435\u043d (\u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 masterhost.ru)<\/h3>\n<p> \u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 DNS <code>https:\/\/cp.masterhost.ru\/dns<\/code> \u0438 \u043f\u043e\u0433\u043d\u0430\u043b\u0438! <\/p>\n<figure class=\"full-width\"><\/figure>\n<figure class=\"full-width\"><\/figure>\n<figure class=\"full-width\"><\/figure>\n<h3>2. \u041f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h3>\n<p><code>dotnet publish -r linux-x64<\/code><\/p>\n<h3>3. \u0417\u0430\u0434\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u0442<\/h3>\n<p> \u0422\u0430\u043a \u043a\u0430\u043a \u0443 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 (\u0441\u0435\u0442\u0435\u0432\u044b\u0435) \u043f\u043e\u0440\u0442\u044b, \u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u0441\u0435 ASP.Net Core \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0430 5000 \u043f\u043e\u0440\u0442\u0443, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412 \u043f\u0430\u043f\u043a\u0435 publish \u043d\u0430\u0445\u043e\u0434\u0438\u043c <code>appsettings.json<\/code>. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: <\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b &#171;Kestrel&#187; \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438:<\/p>\n<pre><code> \"Kestrel\": {     \"Endpoints\": {       \"Http\": {         \"Url\": \"http:\/\/localhost:5005\" \/\/ Change this to your desired port       }     }   }<\/code><\/pre>\n<p> \u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b <code>appsettings.json<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a: <\/p>\n<figure class=\"full-width\"><\/figure>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f ,\u0447\u0442\u043e \u043e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u043f\u043e\u0440\u0442\u0443 5005. <\/p>\n<figure class=\"full-width\"><\/figure>\n<p> \u0418 \u044d\u0442\u043e \u0434\u0430\u0436\u0435 \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043f\u043e\u0434 \u041e\u0421 Windows 10&#215;64 Professional, \u0430 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b\u0438 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0434 Linux. <\/p>\n<figure class=\"full-width\"><\/figure>\n<h3>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 VPS<\/h3>\n<p> \u041b\u044e\u0431\u044b\u043c \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c (\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e FileZilla, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0441\u044c \u043f\u043e SFTP \u0438 \u043f\u0435\u0440\u0435\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u043f\u0438\u0440\u0443\u044e \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 \u0432 \u0434\u0440\u0443\u0433\u0443\u044e) \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u0441 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u043c ASP.Net Core \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <code>\/var\/www<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u044f \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0441\u043e\u0437\u0434\u0430\u043b \u043f\u043e\u0434\u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. <\/p>\n<figure class=\"full-width\"><\/figure>\n<figure class=\"full-width\"><\/figure>\n<h3>5. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 VPS<\/h3>\n<p> \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0441 \u043d\u0430\u0448\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c (TestRazor.dll) <\/p>\n<pre><code>cd \/var\/www\/TestRazor\/publish\/<\/code><\/pre>\n<p> \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0435\u0433\u043e <\/p>\n<pre><code> dotnet TestRazor.dll<\/code><\/pre>\n<figure class=\"full-width\">\n<div><figcaption>\u0412\u0441\u0451 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442!<\/figcaption><\/div>\n<\/figure>\n<h3>6. \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c nginx<\/h3>\n<p> 1. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b <code>test-razor.config<\/code> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f: <\/p>\n<pre><code>server {         listen 80;         listen 443;         server_name test.s****ov.ru;          location \/ {         proxy_pass         http:\/\/127.0.0.1:5005;         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;         }     }<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <strong>server_name <\/strong>(4 \u0441\u0442\u0440\u043e\u043a\u0430). \u041d\u0430\u043f\u0440\u043e\u0442\u0438\u0432 \u043d\u0435\u0433\u043e \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <strong>\u0441\u0432\u043e\u0439_\u043f\u043e\u0434\u0434\u043e\u043c\u0435\u043d.\u0441\u0432\u043e\u0439_\u0434\u043e\u043c\u0435\u043d;<\/strong><\/p>\n<p> 2. \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c <code>test-razor.config<\/code>\u043d\u0430 VPS \u043f\u043e \u043f\u0443\u0442\u0438: <code>\/etc\/nginx\/sites-available<\/code>. <\/p>\n<figure class=\"full-width\"><\/figure>\n<p> 3. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 <code>test-razor.config<\/code><\/p>\n<pre><code>sudo ln -s \/etc\/nginx\/sites-available\/test-razor.config \/etc\/nginx\/sites-enabled\/<\/code><\/pre>\n<p> 4. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e. <\/p>\n<pre><code>sudo nginx -t<\/code><\/pre>\n<figure class=\"full-width\">\n<div><figcaption>\u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e!<\/figcaption><\/div>\n<\/figure>\n<p> 5. \u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c nginx. <\/p>\n<pre><code>sudo systemctl restart nginx<\/code><\/pre>\n<p> \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c nginx \u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <code>\/etc\/nginx\/sites-enabled<\/code> \u043d\u0430 \u043f\u0440\u0435\u0434\u043c\u0435\u0442 \u043a\u0440\u0438\u0432\u044b\u0445\/\u043b\u0435\u0432\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0441\u044b\u043b\u043e\u043a \u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u0435 \u0442\u0430\u043a\u043e\u0432\u044b\u0435, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0435\u0441\u0442\u044c. <\/p>\n<h3>7. \u041e\u0444\u043e\u0440\u043c\u043b\u044f\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043b\u0443\u0436\u0431\u044b (\u0441\u043e\u0437\u0434\u0430\u0435\u043c Unit)<\/h3>\n<p> \u041d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b <code>test_razor.service<\/code> \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e: <\/p>\n<pre><code>[Unit] Description= \u0422\u0435\u0441\u0442\u043e\u0432\u043e\u0435 ASP.Net Core \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435  [Service] WorkingDirectory=\/var\/www\/TestRazor\/publish ExecStart=\/usr\/bin\/dotnet \/var\/www\/TestRazor\/publish\/TestRazor.dll Restart=always # Restart service after 10 seconds if the dotnet service crashes: RestartSec=10 KillSignal=SIGINT SyslogIdentifier=Raven User=root Environment=ASPNETCORE_ENVIRONMENT=Production Environment=DOTNET_NOLOGO=true [Install] WantedBy=multi-user.target<\/code><\/pre>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0449\u0430\u0435\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0443\u0442\u0435\u0439, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 <strong>WorkingDirectory<\/strong> \u0438 <strong>ExecStart<\/strong><\/p>\n<\/blockquote>\n<p> \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0435\u0433\u043e. <\/p>\n<figure class=\"full-width\"><\/figure>\n<p> \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c <code>test_razor.service<\/code> \u043d\u0430 VPS \u043f\u043e \u043f\u0443\u0442\u0438 \u043f\u043e \u043f\u0443\u0442\u0438 <code>\/etc\/systemd\/system<\/code> <\/p>\n<figure class=\"full-width\"><\/figure>\n<p> \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0441\u043b\u0443\u0436\u0431\u044b.<\/p>\n<pre><code>systemctl start test_razor.service systemctl status test_razor.service<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<h3>8. \u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u043f\u043e url<\/h3>\n<figure class=\"full-width\"><\/figure>\n<p>\u041d\u0443, \u0432\u043e\u0442 \u0432 \u043e\u0431\u0449\u0435\u043c-\u0442\u043e \u0438 \u0432\u0441\u0451. \u041f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u044f \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0442\u044c \u0435\u043c\u0443 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u0442 \u0438 \u0441\u0432\u043e\u0439 \u043f\u043e\u0434\u0434\u043e\u043c\u0435\u043d. \u0412\u0441\u0435\u043c \u0443\u0434\u0430\u0447\u0438! \u0416\u0434\u0443 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043f\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0435\u0439.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/871182\/\"> https:\/\/habr.com\/ru\/articles\/871182\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-443974","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/443974","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=443974"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/443974\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=443974"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=443974"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=443974"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}