{"id":2054,"date":"2020-03-20T11:12:03","date_gmt":"2020-03-20T02:12:03","guid":{"rendered":"http:\/\/blog.moramcnt.com\/?p=2054"},"modified":"2020-06-11T17:26:04","modified_gmt":"2020-06-11T08:26:04","slug":"%ec%9a%b0%eb%b6%84%ed%88%ac%ec%97%90%ec%84%9c-asp-net-core-apache-%ec%97%b0%eb%8f%99","status":"publish","type":"post","link":"http:\/\/blog.moramcnt.com\/?p=2054","title":{"rendered":"\uc6b0\ubd84\ud22c\uc5d0\uc11c .ASP NET core Apache \uc5f0\ub3d9"},"content":{"rendered":"<p>\uadf8\ub3d9\uc548 \ud50c\ub7ab\ud3fc\uc5d0 \uad6c\uc560\ub97c \ubc1b\uc9c0\uc54a\ub294 Java \uae30\ubc18\uc744 \ub9ce\uc774 \ud65c\uc6a9\ud558\uc600\ub294\ub370, net core\ub3c4 \ub9ac\ub205\uc2a4, \ub9e5\uc5d0\uc11c\ub3c4 \uad6c\ub3d9\uac00\ub2a5\ud558\uc5ec<br \/>\n\uc6b0\ubd84\ud22c \ud658\uacbd\uc5d0\uc11c MSA \uae30\ubc18\uc758 \uc778\uc99d\uc11c\ubc84\ub97c \uad6c\ud604\ud558\uc5ec \ubcf4\uc558\ub2e4.<\/p>\n<p>\ubcf8 \ub0b4\uc6a9\uc740 \ub9c8\uc774\ud06c\ub85c \uc18c\ud504\ud2b8\uc758 \uc544\ub798 \ub9c1\ud06c\ub97c \ucc38\uc870\ud558\uc5ec \ud604\uc7ac \ud504\ub85c\uc81d\ud2b8 \uc0c1\ud669\uc5d0 \ub9de\uac8c \uc218\uc815\ud558\uc600\ub2e4.<br \/>\nhttps:\/\/docs.microsoft.com\/ko-kr\/aspnet\/core\/host-and-deploy\/linux-apache?view=aspnetcore-3.1<\/p>\n<p><b>1. \ud658\uacbd<\/b><br \/>\n-NET Core \uc6b0\ubd84\ud22c \uc124\uce58\ub294 \uc778\ud130\ub137\uc5d0 \ub9ce\uc774 \ub098\uc640\uc788\uc73c\ubbc0\ub85c \uc0dd\ub7b5\ud568<br \/>\n-Apache\ub294 \uac1c\ubc1c\uc11c\ubc84\uc5d0 \uc124\uce58\ub418\uc5b4 \uc788\ub294 \uac83\uc744 \ud65c\uc6a9\ud558\ubbc0\ub85c \uc124\uce58 \uacfc\uc815 \ubb38\uc11c\ub294 \uc0dd\ub7b5\ud568<\/p>\n<p><b>2. \ubc30\ud3ec<\/b><br \/>\n&#8211; \ube44\uc96c\uc5bc \uc2a4\ud29c\ub514\uc624 \uac8c\uc2dc\ub97c \ud1b5\ud574 \uac8c\uc2dc\ub41c \ud3f4\ub354\ub97c \uc54c\uc9d1\uc73c\ub85c \uc555\ucd95\ud558\uc5ec \uc6b0\ubd84\ud22c\uc5d0 FTP\ub85c \uc5c5\ub85c\ub4dc.<br \/>\n&#8211; \/home\/idr\/Service\/Identity\/Identity.WebApi \ud3f4\ub354\uc5d0 \uc555\ucd95\uc744 \ud480\uc5b4 \ubc30\ud3ec<br \/>\n&#8211; unzip Identity.WebApi.zip -d Identity.WebApi<\/p>\n<p><b>3. \ud504\ub85d\uc2dc \uc11c\ubc84\uad6c\uc131<\/b><br \/>\n&#8211; \uc0ac\uc6a9\uc790\uac00 Apache\ub97c \ud1b5\ud574 \uc694\uccad\uc744 \ud558\uba74 .net core\uc758 Kestrel \uc11c\ubc84\ub85c \uc804\ub2ec\ud574\uc8fc\uae30 \uc704\ud574\uc11c\ub294 \uc5ed\ubc29\ud5a5 \ud504\ub85d\uc2dc \uc11c\ubc84\ub97c \uad6c\uc131\ud574\uc57c \ud568.<br \/>\n&#8211; \uc815\ubc61\ud5a5 \ub610\ub294 \uc5ed\ubc29\ud5a5\ud504\ub85d\uc2dc\uc5d0 \ub300\ud55c \uae30\uc220\ubb38\uc11c\ub294 \uad6c\uae00\uac80\uc0c9\uc744 \ucc38\uace0.<br \/>\n&#8211; \ud504\ub85c\uadf8\ub7a8\uc0c1 Startup.cs \ud30c\uc77c\uc5d0 \uc544\ub798\uc640 \uac19\uc774 \ucd94\uac00\ud574 \uc900\ub2e4.<br \/>\n* \ud14c\uc2a4\ud2b8\ud574\ubcf4\ub2c8 \uc544\ub798\ucc98\ub7fc \uc548\ud574\ub3c4 \ub3d9\uc791\uc740 \ud55c\ub2e4.<\/p>\n<pre>\r\npublic void Configure(IApplicationBuilder app, IWebHostEnvironment env)\r\n{\r\n        ...\r\n\r\n\tapp.UseRouting();\r\n\r\n\t\/\/ Apache \ub610\ub294 IIS \uc5ed\ubc29\ud5a5 \ud504\ub85d\uc2dc\r\n\t\/\/ using Microsoft.AspNetCore.HttpOverrides;\uc744 \ud574\uc57c\ud568\r\n\tapp.UseForwardedHeaders(new ForwardedHeadersOptions {\r\n\t\t\tForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto\r\n\t});\r\n}\r\n<\/pre>\n<p><b>4. Apache \uad6c\uc131<\/b><\/p>\n<p><b>4.1 \ud658\uacbd\uc124\uc815<\/b><\/p>\n<pre>\r\ncd \/etc\/apache2\/sites-available\r\nvi identity.mbizok.com.conf\r\n<\/pre>\n<pre>\r\nRequestHeader set \"X-Forwarded-Proto\" expr=%{REQUEST_SCHEME}\r\n\r\nProxyPreserveHost On\r\nProxyPass \/ http:\/\/127.0.0.1:6002\/\r\nProxyPassReverse \/ http:\/\/127.0.0.1:6002\/\r\nServerName identity.mbizok.com\r\nServerAlias identity.mbizok.com\r\nErrorLog \/var\/log\/apache2\/error-identity.mbizok.com.log\r\nCustomLog \/var\/log\/apache2\/access-identity.mbizok.com.log common\r\n<\/pre>\n<p><b>4.2 \uc0ac\uc774\ud2b8\ud65c\uc131\ud654<\/b><\/p>\n<pre>\r\na2ensite identity.mbizok.com.conf\r\nservice apache2 restart\r\n<\/pre>\n<p><b>4.3 \ub85c\uadf8 \ud655\uc778<\/b><br \/>\n&#8211; \uc5d0\ub7ec\uac00 \ubc1c\uc0dd\ud558\uc5ec \ub85c\uadf8 \ud655\uc778<\/p>\n<pre>\r\nsystemctl status apache2.service\r\n\r\n3m&lt;94&gt; 19 16:36:06 moramlinux apache2[19883]: AH00526: Syntax error on line 2 of \/etc\/apache2\/sites-enabled\/identity.mbizok.com.conf:\r\n3m&lt;94&gt; 19 16:36:06 moramlinux apache2[19883]: Invalid command 'RequestHeader', perhaps misspelled or defined by a module not included in the server configuration\r\n<\/pre>\n<p>&#8211; \uc544\ud30c\uce58 \ubaa8\ub4c8 \uc124\uce58 \ubc0f \uc544\ud30c\uce58 \uc7ac\uc2dc\uc791<\/p>\n<pre>\r\na2enmod headers\r\nservice apache2 restart\r\n<\/pre>\n<p><b>5. Kestrel \uc11c\ube44\uc2a4<\/b><br \/>\n 6002 \ud3ec\ud2b8\ub85c \ub3c4\ub294 API \uc11c\ubc84\ub97c \uc2e4\ud589\ud558\uae30 \uc704\ud574 kestrel \uc11c\ube44\uc2a4\ub97c \ub9cc\ub4e4\uc5b4\uc57c \ud568.<\/p>\n<p><b>5.1 \uc124\uc815\ud654\uc77c<\/b><br \/>\nvi \/etc\/systemd\/system\/kestrel-identity.mbizok.com.service<\/p>\n<pre>\r\n[Unit]\r\nDescription= Identity Web Api\r\n\r\n[Service]\r\nWorkingDirectory=\/home\/idr\/Service\/Identity\/Identity.WebApi\r\nExecStart=\/usr\/bin\/dotnet \/home\/idr\/Service\/Identity\/Identity.WebApi\/Identity.WebApi.dll --urls=\"http:\/\/127.0.0.1:6002\"\r\nRestart=always\r\n# Restart service after 10 seconds if the dotnet service crashes:\r\nRestartSec=10\r\nKillSignal=SIGINT\r\nSyslogIdentifier=dotnet-example\r\nUser=idr\r\nEnvironment=ASPNETCORE_ENVIRONMENT=Production\r\n\r\n[Install]\r\nWantedBy=multi-user.target\r\n<\/pre>\n<p><b>5.2 \uc11c\ube44\uc2a4 \ud65c\uc131\ud654<\/b><\/p>\n<pre>\r\nsystemctl enable kestrel-identity.mbizok.com.service\r\n<\/pre>\n<p><b>5.3 \uc11c\ube44\uc2a4 \uc2dc\uc791<\/b><\/p>\n<pre>\r\nsystemctl start kestrel-identity.mbizok.com.service\r\n<\/pre>\n<p><b>5.4 \uc11c\ube44\uc2a4 \uc0c1\ud0dc\ud655\uc778<\/b><\/p>\n<pre>\r\nsystemctl status kestrel-identity.mbizok.com.service\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\uadf8\ub3d9\uc548 \ud50c\ub7ab\ud3fc\uc5d0 \uad6c\uc560\ub97c \ubc1b\uc9c0\uc54a\ub294 Java \uae30\ubc18\uc744 \ub9ce\uc774 \ud65c\uc6a9\ud558\uc600\ub294\ub370, net core\ub3c4 \ub9ac\ub205\uc2a4, \ub9e5\uc5d0\uc11c\ub3c4 \uad6c\ub3d9\uac00\ub2a5\ud558\uc5ec \uc6b0\ubd84\ud22c \ud658\uacbd\uc5d0\uc11c MSA \uae30\ubc18\uc758 \uc778\uc99d\uc11c\ubc84\ub97c \uad6c\ud604\ud558\uc5ec \ubcf4\uc558\ub2e4. \ubcf8 \ub0b4\uc6a9\uc740 \ub9c8\uc774\ud06c\ub85c \uc18c\ud504\ud2b8\uc758 \uc544\ub798 \ub9c1\ud06c\ub97c \ucc38\uc870\ud558\uc5ec \ud604\uc7ac \ud504\ub85c\uc81d\ud2b8 \uc0c1\ud669\uc5d0 \ub9de\uac8c \uc218\uc815\ud558\uc600\ub2e4. https:\/\/docs.microsoft.com\/ko-kr\/aspnet\/core\/host-and-deploy\/linux-apache?view=aspnetcore-3.1 1. \ud658\uacbd -NET Core \uc6b0\ubd84\ud22c \uc124\uce58\ub294 \uc778\ud130\ub137\uc5d0 \ub9ce\uc774 \ub098\uc640\uc788\uc73c\ubbc0\ub85c \uc0dd\ub7b5\ud568 -Apache\ub294 \uac1c\ubc1c\uc11c\ubc84\uc5d0 \uc124\uce58\ub418\uc5b4 \uc788\ub294 \uac83\uc744 \ud65c\uc6a9\ud558\ubbc0\ub85c \uc124\uce58 \uacfc\uc815 \ubb38\uc11c\ub294 \uc0dd\ub7b5\ud568 2. \ubc30\ud3ec [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[255,8,4],"tags":[256,257,258],"class_list":["post-2054","post","type-post","status-publish","format-standard","hentry","category-netcore","category-dotnet","category-4","tag-net-core","tag-asp-net-"],"_links":{"self":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/2054","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2054"}],"version-history":[{"count":6,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/2054\/revisions"}],"predecessor-version":[{"id":2060,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/2054\/revisions\/2060"}],"wp:attachment":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2054"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2054"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}