{"id":76,"date":"2019-11-28T16:28:00","date_gmt":"2019-11-28T07:28:00","guid":{"rendered":"http:\/\/sumomo.ohwaki.jp\/wordpress\/?p=76"},"modified":"2019-12-03T17:34:10","modified_gmt":"2019-12-03T08:34:10","slug":"blazor-server-side%e3%82%a2%e3%83%97%e3%83%aa%e3%82%92centos7apache%e3%81%a7%e5%85%ac%e9%96%8b%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f","status":"publish","type":"post","link":"https:\/\/sumomo.ohwaki.jp\/wordpress\/?p=76","title":{"rendered":"blazor server side\u30a2\u30d7\u30ea\u3092CentOS7+Apache\u3067\u516c\u958b\u3057\u3066\u307f\u305f"},"content":{"rendered":"\n<p>\u4ee5\u524d\u306b\u3082\u66f8\u3044\u305f\u3068\u304a\u308a\u3001dotnet core 3\u304b\u3089blazor server side\u30a2\u30d7\u30ea\u304c\u6b63\u5f0f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002\u6b8b\u5ff5\u306a\u304c\u3089\u3001wasm\u7248\u306f3.1\u304b\u3089\u306e\u30b5\u30dd\u30fc\u30c8\u3068\u306a\u308b\u3002(\u03b2\u3067\u306f\u52d5\u4f5c\u78ba\u8a8d\u6e08\u307f)<\/p>\n\n\n\n<p>\u3067\u3001blazor\u3068\u3044\u3046\u304baps.net core\u306e\u30a2\u30d7\u30ea\u3092\u5b9f\u74b0\u5883\u306b\u516c\u958b\u3057\u3066\u307f\u305f\u304f\u306a\u3063\u305f\u306e\u3067\u3001\u8272\u3005\u8abf\u3079\u3066\u307f\u305f\u3002<\/p>\n\n\n\n<p>\u307e\u305a\u3001\u3053\u306e\u30d6\u30ed\u30b0\u304c\u52d5\u3044\u3066\u3044\u308b\u3001VPS\u306fCentOS6\u306a\u306e\u3067\u3001dotnet core 3\u306f\u52d5\u4f5c\u3057\u306a\u3044\u3002\u4ed5\u65b9\u306a\u3044\u306e\u3067\u3001CentOS7\u306eVPS\u3092\u5225\u9014\u5951\u7d04\u3002<\/p>\n\n\n\n<p>\u305d\u306eVPS\u4e0a\u306bdotnet core 3 sdk\u3092\u5c0e\u5165\u5f8c\u3001\u7c21\u5358\u306ablazor server side\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3002<br>dotnet run\u3067\u958b\u767a\u30e2\u30fc\u30c9\u306b\u3066\u52d5\u4f5c\u78ba\u8a8d\u5f8c\u3001\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3067\u30ea\u30ea\u30fc\u30b9\u7248\u3092\u4f5c\u6210\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dotnet publish --configuration Release<\/code><\/pre>\n\n\n\n<p>\u3053\u308c\u3067\u3001bin\/Release\/&lt;target framework&gt;\/publish\u30d5\u30a9\u30eb\u30c0\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u30d3\u30eb\u30c9\u3055\u308c\u308b\u3002\u30d3\u30eb\u30c9\u3055\u308c\u305f\u30d5\u30a9\u30eb\u30c0\u4e2d\u306b\u3001&lt;\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u540d&gt;.dll\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3067\u52d5\u4f5c\u3059\u308b\u4e8b\u3092\u78ba\u8a8d\u3059\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dotnet &lt;\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u540d>.dll<\/code><\/pre>\n\n\n\n<p>\u4f55\u3082\u8a2d\u5b9a\u305b\u305a\u306b\u52d5\u304b\u3057\u3066\u307f\u308b\u3068\u3001http:\/\/localhost:5000\u304a\u3088\u3073https:\/\/localhost:5001\u3067Listen\u3057\u3066\u3044\u308b\u3002\u5f85\u53d7\u3051\u30a2\u30c9\u30ec\u30b9\u3084\u30dd\u30fc\u30c8\u3092\u5909\u66f4\u3059\u308b\u306b\u306f\u3001\u540c\u4e00\u30d5\u30a9\u30eb\u30c0\u4e2d\u306eappsetting.json\u306b\u4e0b\u8a18\u30bb\u30af\u30b7\u30e7\u30f3\u3092\u52a0\u3048\u308b\u306e\u304c\u7c21\u5358\u306a\u65b9\u6cd5\u3060\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  \"Kestrel\" : {\n    \"EndPoints\" : {\n        \"Http\" : {\n          \"Url\" : \"http:\/\/\u30fb\u30fb\u30fb:&lt;\u5f85\u53d7\u3051\u30dd\u30fc\u30c8\u756a\u53f7>\"\n        }\n    }\n  },<\/code><\/pre>\n\n\n\n<p>\u3053\u308c\u3092\u5916\u90e8\u306b\u516c\u958b\u3059\u308b\u306e\u3060\u304c\u3001\u4eca\u56de\u306fapache httpd\u306evirtual host\u6a5f\u80fd\u3068\u3001proxy\u304a\u3088\u3073URL\u66f8\u63db\u6a5f\u80fd\u3092\u5229\u7528\u3057\u3066\u516c\u958b\u3059\u308b\u3053\u3068\u306b\u3057\u305f\u3002(\u4e00\u756a\u7c21\u5358\u3060\u3068\u601d\u3046)<\/p>\n\n\n\n<p>Kestrel\u306e\u5f85\u53d7\u3051URL\u3092http:\/\/localhost:5000\u3068\u3057\u305f\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u305fconf\u30d5\u30a1\u30a4\u30eb\u3092\/etc\/httpd\/conf.d\u306b\u7f6e\u3044\u3066httpd\u3092\u30ea\u30b9\u30bf\u30fc\u30c8\u3057\u3088\u3046\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># URL\u3067\u5b9b\u5148\u5207\u66ff\n# \u4e00\u822c\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u7528\n&lt;VirtualHost *:80>\n        DocumentRoot \/var\/www\/html\n        ServerName www.hoge.jp\n&lt;\/VirtualHost>\n# asp.net core\u30a2\u30d7\u30ea\u7528\n# URL\u306e\u66f8\u63db\u306fblazor server side\u30a2\u30d7\u30ea\u304cSignalR\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\n# \u6700\u521d\u3001\u3053\u308c\u304c\u7121\u304b\u3063\u305f\u306e\u3067\u3001\u30da\u30fc\u30b8\u306f\u8868\u793a\u3055\u308c\u308b\u3051\u3069\u3001\u30a4\u30d9\u30f3\u30c8\u304c\n# \u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3055\u308c\u306a\u304b\u3063\u305f\u30fb\u30fb\u30fb\n&lt;VirtualHost *:80>\n        ServerName aspcore.hoge.jp\n        ProxyPass \/ http:\/\/localhost:5000\/\n        ProxyPassReverse \/ http:\/\/localhost:5000\/\n        RewriteEngine on\n        RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]\n        RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]\n        RewriteRule \/(.*) ws:\/\/127.0.0.1:5000\/$1 [P]\n&lt;\/VirtualHost>\n<\/code><\/pre>\n\n\n\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\u3053\u306e\u72b6\u614b\u3067\u3001dotnet &lt;\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u540d&gt;.dll\u3067\u30a2\u30d7\u30ea\u3092\u5b9f\u884c\u3001\u5916\u90e8\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u308b\u3068\u3001\u3061\u3083\u3093\u3068\u52d5\u4f5c\u3002<br>\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u30b3\u30e1\u30f3\u30c8\u306b\u3082\u66f8\u3044\u3066\u3042\u308b\u3051\u3069\u3001\u6700\u521dProxyPass\u3068ProsyReversePass\u3060\u3051\u8a2d\u5b9a\u3057\u3066\u52d5\u304b\u3057\u305f\u3089\u3001\u30da\u30fc\u30b8\u81ea\u4f53\u306f\u8868\u793a\u3055\u308c\u305f\u3051\u3069\u3001\u30a4\u30d9\u30f3\u30c8\u51e6\u7406\u304cNG\u3002\u66f8\u63db\u30eb\u30fc\u30eb\u8ffd\u52a0\u3092\u5fd8\u308c\u306a\u3044\u3088\u3046\u306b(\u6c57)<\/p>\n\n\n\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\u758e\u901a\u306f\u3046\u307e\u304f\u3044\u3063\u305f\u306e\u3067\u3001\u30a2\u30d7\u30ea\u3092\u30b5\u30fc\u30d3\u30b9\u5316\u3057\u3088\u3046\u3002<br>\u65b9\u6cd5\u306f <a href=\"https:\/\/docs.microsoft.com\/ja-jp\/aspnet\/core\/host-and-deploy\/linux-apache?view=aspnetcore-3.0\">https:\/\/docs.microsoft.com\/ja-jp\/aspnet\/core\/host-and-deploy\/linux-apache?view=aspnetcore-3.0<\/a> \u306a\u3069\u306b\u66f8\u304b\u308c\u3066\u3044\u308b\u3088\u3046\u306b\u3001 \/etc\/systemd\/system \u306b\u30b5\u30fc\u30d3\u30b9\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u3001\u30b5\u30fc\u30d3\u30b9\u3092\u958b\u59cb\u3057\u3066\u3042\u3052\u308c\u3070OK\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[Unit]\nDescription=\u30b5\u30fc\u30d3\u30b9\u306e\u8aac\u660e\n\n[Service]\nWorkingDirectory=&lt;\u4f5c\u696d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea>\nExecStart=\/usr\/bin\/dotnet &lt;dll\u306e\u30d5\u30eb\u30d1\u30b9>\nRestart=always\n# Restart service after 10 seconds if the dotnet service crashes:\nRestartSec=10\nKillSignal=SIGINT\nSyslogIdentifier=&lt;Syslog\u306b\u66f8\u304d\u51fa\u3059\u3068\u304d\u306eprefix>\nUser=apache\nEnvironment=ASPNETCORE_ENVIRONMENT=Production \n\n[Install]\nWantedBy=multi-user.target<\/code><\/pre>\n\n\n\n<p>\u3061\u306a\u307f\u306b\u3001\u4e0a\u8a18\u30ea\u30f3\u30af\u306edotnet\u30d1\u30b9\u306f\/usr\/local\/bin\u3068\u306a\u3063\u3066\u3044\u308b\u304c\u3001\u666e\u901a\u306bdotnet core sdk\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3068\u3001\/usr\/bin\u306bdotnet\u30b3\u30de\u30f3\u30c9\u304c\u7f6e\u304b\u308c\u308b\u3088\u3046\u3060\u3002<br>\u30b5\u30fc\u30d3\u30b9\u5b9a\u7fa9\u5f8c\u3001\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3067\u30b5\u30fc\u30d3\u30b9\u3092\u6709\u52b9\u5316\u3057\u3066\u3001\u8d77\u52d5\u3001\u72b6\u614b\u78ba\u8a8d\u3092\u884c\u3046\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># systemctl enable &lt;\u30b5\u30fc\u30d3\u30b9\u30d5\u30a1\u30a4\u30eb\u540d>\n# systemctl start &lt;\u30b5\u30fc\u30d3\u30b9\u30d5\u30a1\u30a4\u30eb\u540d>\n# systemctl status &lt;\u30b5\u30fc\u30d3\u30b9\u30d5\u30a1\u30a4\u30eb\u540d>\n\u25cf &lt;\u30b5\u30fc\u30d3\u30b9\u30d5\u30a1\u30a4\u30eb\u540d> - &lt;\u30b5\u30fc\u30d3\u30b9\u8aac\u660e>\n   Loaded: loaded (\/etc\/systemd\/system\/&lt;\u30b5\u30fc\u30d3\u30b9\u30d5\u30a1\u30a4\u30eb\u540d>; enabled; vendor preset: disabled)\n   Active: active (running) since \u30fb\u30fb\u30fb ago\n Main PID: 9999 (dotnet)\n   CGroup: \/system.slice\/&lt;\u30b5\u30fc\u30d3\u30b9\u30d5\u30a1\u30a4\u30eb\u540d>\n           mq7906 \/usr\/bin\/dotnet &lt;DLL\u30d5\u30eb\u30d1\u30b9>\n<\/code><\/pre>\n\n\n\n<p>\u3053\u308c\u3067\u3001\u4e00\u5fdc\u516c\u958b\u5b8c\u4e86\u3002<br>\u5b9f\u969b\u306b\u306f\u7d50\u69cb\u8272\u3005\u306a\u3068\u3053\u308d\u3067\u8e93\u3044\u3066\u3044\u308b\u306e\u3067\u3001\u5099\u5fd8\u9332\u7684\u306b\u6295\u7a3f\u3057\u3066\u307f\u305f\u3002<\/p>\n\n\n\n<p>\u3061\u306a\u307f\u306b\u3001\u516c\u958b\u3057\u305f\u30da\u30fc\u30b8\u306f\u4ee5\u4e0b\u306e\u30ea\u30f3\u30af\u304b\u3089\u53c2\u7167\u53ef\u80fd\u3002<br><a href=\"http:\/\/dnetapp.ohwaki.jp\/gradation\">http:\/\/dnetapp.ohwaki.jp\/gradation<\/a> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u524d\u306b\u3082\u66f8\u3044\u305f\u3068\u304a\u308a\u3001dotnet core 3\u304b\u3089blazor server  &hellip; <a href=\"https:\/\/sumomo.ohwaki.jp\/wordpress\/?p=76\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,10,9,11,4],"tags":[],"class_list":["post-76","post","type-post","status-publish","format-standard","hentry","category-asp-net-core","category-blazor","category-c","category-dotnetcore","category-4"],"_links":{"self":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/76","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=76"}],"version-history":[{"count":2,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/76\/revisions"}],"predecessor-version":[{"id":78,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/76\/revisions\/78"}],"wp:attachment":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=76"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=76"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=76"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}