{"id":1189,"date":"2020-06-23T19:57:14","date_gmt":"2020-06-23T10:57:14","guid":{"rendered":"https:\/\/www.kwonline.org\/memo2\/?p=1189"},"modified":"2020-06-23T19:58:36","modified_gmt":"2020-06-23T10:58:36","slug":"ubuntu-20-04-nginx-reverse-proxy-and-ssl","status":"publish","type":"post","link":"https:\/\/www.kwonline.org\/memo2\/2020\/06\/23\/ubuntu-20-04-nginx-reverse-proxy-and-ssl\/","title":{"rendered":"Ubuntu: Nginx\u3067\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u3068SSL"},"content":{"rendered":"<p>Ubuntu 20.04\u3067Nginx\u3067\u30ea\u30d0\u30d7\u30ed\u3068SSL\u8a2d\u5b9a\u3092\u3088\u304f\u884c\u3046\u306e\u3067\u30e1\u30e2<\/p>\n<p>\u307e\u305a\u306fnginx\u3068certbot\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ sudo apt install nginx certbot python3-certbot-nginx -y\r\n<\/pre>\n<p>\u7d9a\u3044\u3066LetsEncrypt\u306e\u8a3c\u660e\u66f8\u3092\u53d6\u5f97<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ sudo certbot --nginx -d hoge.example.com\r\n<\/pre>\n<p>\u8af8\u3005\u8cea\u554f\u306b\u7b54\u3048\u3066SSL\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5b8c\u4e86\u3002<\/p>\n<p>\u305d\u3057\u3066 \u30ea\u30d0\u30d7\u30ed\u8a2d\u5b9a\u3092 \/etc\/nginx\/sites-available\/default \u306b\u8a18\u5165\u3059\u308b\u3002<br \/>\n\u3057\u304b\u3057\u3001\u4ee5\u964dcertbot\u304c\u8a3c\u660e\u66f8\u66f4\u65b0\u3092\u3059\u308b\u6642\u306b\u306fHTTP80\u756a\u30dd\u30fc\u30c8\u3092\u4f7f\u3063\u3066\u66f4\u65b0\u3059\u308b\u306e\u3067\u3001\u30ea\u30d0\u30d7\u30ed\u8a2d\u5b9a\u306fSSL443\u756a\u3060\u3051\u306b\u3057\u3066\u304a\u3044\u305f\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nserver {\r\n    #80\u756a\u7528\r\n    listen 80;\r\n    server_name _;\r\n    #\u4e2d\u7565\r\n}\r\n\r\nserver {\r\n    #443\u756a\u7528\r\n    listen 443 ssl;\r\n    server_name hoge.example.com;\r\n\r\n    location \/ {\r\n            proxy_pass http:\/\/localhost:8080;\r\n            proxy_pass_request_headers on;\r\n    }\r\n    #\u4ee5\u4e0b\u8a3c\u660e\u66f8\u8a2d\u5b9a\u306a\u3069\r\n    #\r\n}\r\n<\/pre>\n<p>\u305d\u3057\u3066nginx\u3092\u518d\u8d77\u52d5<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ sudo systemctl restart nginx\r\n<\/pre>\n<p>\u3053\u308c\u3067HTTP\u306f\u305d\u306e\u307e\u307enginx\u306ehtml\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u898b\u305b\u3066\u3001HTTPS\u306e443\u756a\u3060\u3051\u3092localhost:8080\u306b\u8ee2\u9001\u3059\u308b\u3002<br \/>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu 20.04\u3067Nginx\u3067\u30ea\u30d0\u30d7\u30ed\u3068SSL\u8a2d\u5b9a\u3092\u3088\u304f\u884c\u3046\u306e\u3067\u30e1\u30e2 \u307e\u305a\u306fnginx\u3068certbot\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b $ sudo apt install nginx certbot python3-cert [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-1189","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/posts\/1189","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/comments?post=1189"}],"version-history":[{"count":4,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/posts\/1189\/revisions"}],"predecessor-version":[{"id":1193,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/posts\/1189\/revisions\/1193"}],"wp:attachment":[{"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/media?parent=1189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/categories?post=1189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/tags?post=1189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}