{"id":223,"date":"2023-02-13T13:37:39","date_gmt":"2023-05-21T10:03:22","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/index.php\/2023\/11\/30\/ubuntu-22-04%e3%81%ab%e3%81%8a%e3%81%84%e3%81%a6%e3%80%81uwsgi%e3%81%a8nginx%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6flask%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3\/"},"modified":"2025-07-31T21:47:06","modified_gmt":"2025-07-31T12:47:06","slug":"ubuntu-22-04%e3%81%ab%e3%81%8a%e3%81%84%e3%81%a6%e3%80%81uwsgi%e3%81%a8nginx%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6flask%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%ab%e3%81%8a%e3%81%84%e3%81%a6%e3%80%81uwsgi%e3%81%a8nginx%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6flask%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3\/","title":{"rendered":"Ubuntu 22.04\u306b\u304a\u3044\u3066\u3001uWSGI\u3068Nginx\u3092\u4f7f\u7528\u3057\u3066Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u65b9\u6cd5\u3002"},"content":{"rendered":"<h3>\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u65e5\u672c\u8a9e\u3067\u81ea\u7136\u306a\u8a00\u3044\u56de\u3057\u306b\u8a00\u3044\u63db\u3048\u3066\u304f\u3060\u3055\u3044\u3002\u4e00\u3064\u306e\u9078\u629e\u80a2\u3067\u69cb\u3044\u307e\u305b\u3093\u3002<\/h3>\n<p>\u30a4\u30f3\u30c8\u30ed\u30c0\u30af\u30b7\u30e7\u30f3<\/p>\n<p>\u3053\u306e\u30ac\u30a4\u30c9\u3067\u306f\u3001Ubuntu 22.04\u4e0a\u3067Flask\u30de\u30a4\u30af\u30ed\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u4f7f\u7528\u3057\u3066Python\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3057\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u306e\u5927\u90e8\u5206\u306f\u3001uWSGI\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u65b9\u6cd5\u3084\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u8d77\u52d5\u65b9\u6cd5\u3001Nginx\u306e\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u9006\u30d7\u30ed\u30ad\u30b7\u3068\u3057\u3066\u306e\u8a2d\u5b9a\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<h2>\u524d\u63d0\u6761\u4ef6<\/h2>\n<p>\u3053\u306e\u30ac\u30a4\u30c9\u3092\u59cb\u3081\u308b\u524d\u306b\u3001\u6b21\u3092\u6e96\u5099\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\uff1a<\/p>\n<ul class=\"post-ul\">\n<li>A server with Ubuntu 22.04 installed and a non-root user with sudo privileges. Follow our initial server setup guide for guidance.<\/li>\n<li>Nginx installed, following Steps 1 through 3 of How To Install Nginx on Ubuntu 22.04.<\/li>\n<li>A domain name configured to point to your server. You can purchase one on Namecheap or get one for free on Freenom. You can learn how to point domains to Silicon Cloud by following the relevant documentation on domains and DNS. This tutorial assumes you\u2019ve created the following DNS records:An A record with your_domain pointing to your server\u2019s public IP address.<br \/>\nAn A record with www.your_domain pointing to your server\u2019s public IP address.<\/li>\n<\/ul>\n<p>\u3055\u3089\u306b\u3001\u3053\u306e\u30ac\u30a4\u30c9\u3067\u8a2d\u5b9a\u3059\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u3067\u3042\u308buWSGI\u3068\u3001WSGI\u4ed5\u69d8\u306b\u3064\u3044\u3066\u4e00\u90e8\u77e5\u8b58\u3092\u8eab\u306b\u3064\u3051\u308b\u3068\u5f79\u306b\u7acb\u3064\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u3053\u306e\u5b9a\u7fa9\u3084\u6982\u5ff5\u306e\u8b70\u8ad6\u3067\u306f\u3001\u305d\u308c\u3089\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u8aac\u660e\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u30b9\u30c6\u30c3\u30d71 \u2014 Ubuntu\u30ea\u30dd\u30b8\u30c8\u30ea\u304b\u3089\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<p>\u6700\u521d\u306e\u30b9\u30c6\u30c3\u30d7\u306f\u3001Ubuntu\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u304b\u3089\u5fc5\u8981\u306a\u3059\u3079\u3066\u306e\u30d1\u30fc\u30c4\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u3067\u3059\u3002 \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u5fc5\u8981\u306e\u3042\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u306f\u3001Python\u30d1\u30c3\u30b1\u30fc\u30b8\u30de\u30cd\u30fc\u30b8\u30e3\u3067\u3042\u308bpip\u304c\u542b\u307e\u308c\u3066\u304a\u308a\u3001Python\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u7ba1\u7406\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002 \u307e\u305f\u3001uWSGI\u3092\u30d3\u30eb\u30c9\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306aPython\u958b\u767a\u30d5\u30a1\u30a4\u30eb\u3082\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<p>\u6700\u521d\u306b\u3001\u30ed\u30fc\u30ab\u30eb\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u66f4\u65b0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> update<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u305d\u306e\u5f8c\u3001Python\u74b0\u5883\u3092\u69cb\u7bc9\u3067\u304d\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u306b\u306fpython3-pip\u3092\u306f\u3058\u3081\u3068\u3059\u308b\u3001\u9811\u5065\u306a\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u74b0\u5883\u306b\u5fc5\u8981\u306a\u3044\u304f\u3064\u304b\u306e\u8ffd\u52a0\u30d1\u30c3\u30b1\u30fc\u30b8\u3068\u958b\u767a\u30c4\u30fc\u30eb\u304c\u542b\u307e\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> <span class=\"token function\">install<\/span> python3-pip python3-dev build-essential libssl-dev libffi-dev python3-setuptools<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3053\u308c\u3089\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u6e96\u5099\u3067\u304d\u305f\u3089\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u305f\u3081\u306e\u4eee\u60f3\u74b0\u5883\u3092\u4f5c\u6210\u3059\u308b\u6e96\u5099\u304c\u6574\u3044\u307e\u3057\u305f\u3002<\/p>\n<h2>\u30b9\u30c6\u30c3\u30d72 &#8211; Python\u4eee\u60f3\u74b0\u5883\u306e\u4f5c\u6210<\/h2>\n<p>Python\u306e\u4eee\u60f3\u74b0\u5883\u3068\u306f\u3001\u7279\u5b9a\u306ePython\u30d0\u30fc\u30b8\u30e7\u30f3\u3068\u305d\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u5fc5\u8981\u306aPython\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u542b\u307e\u308c\u308b\u81ea\u5df1\u5b8c\u7d50\u578b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u3053\u3068\u3067\u3059\u3002\u3053\u308c\u306f\u3001\u5404\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u4f9d\u5b58\u95a2\u4fc2\u3092\u500b\u5225\u306b\u7ba1\u7406\u3059\u308b\u3053\u3068\u306b\u3088\u308a\u3001\u540c\u3058\u30b7\u30b9\u30c6\u30e0\u4e0a\u306e\u4ed6\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u306e\u9593\u3092\u5206\u96e2\u3059\u308b\u305f\u3081\u306b\u5f79\u7acb\u3061\u307e\u3059\u3002\u3053\u306e\u624b\u9806\u3067\u306f\u3001Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306ePython\u306e\u4eee\u60f3\u74b0\u5883\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3057\u307e\u3059\u3002<\/p>\n<p>python3-venv\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3001venv\u30e2\u30b8\u30e5\u30fc\u30eb\u3082\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> <span class=\"token function\">install<\/span> python3-venv<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u6b21\u306b\u3001Flask\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u89aa\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">mkdir<\/span> ~\/<mark>myproject<\/mark><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4f5c\u6210\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3057\u3066\u304f\u3060\u3055\u3044\u3002 (Sakusei shita direkutori ni id\u014d shite kudasai.)<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token builtin class-name\">cd<\/span> ~\/<mark>myproject<\/mark><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u3066\u3001Flask\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306ePython\u306e\u8981\u4ef6\u3092\u4fdd\u5b58\u3059\u308b\u305f\u3081\u306e\u4eee\u60f3\u74b0\u5883\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">python3.10 <span class=\"token parameter variable\">-m<\/span> venv <mark>myprojectenv<\/mark><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3053\u308c\u306b\u3088\u3063\u3066\u3001Python\u3068pip\u306e\u30ed\u30fc\u30ab\u30eb\u30b3\u30d4\u30fc\u304c\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306emyprojectenv\u3068\u3044\u3046\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u4eee\u60f3\u74b0\u5883\u3078\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u524d\u306b\u3001\u307e\u305a\u305d\u308c\u3092\u30a2\u30af\u30c6\u30a3\u30d9\u30fc\u30c8\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u6b21\u306e\u3088\u3046\u306b\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token builtin class-name\">source<\/span> <mark>myprojectenv<\/mark>\/bin\/activate<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4eee\u60f3\u74b0\u5883\u5185\u3067\u64cd\u4f5c\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u793a\u3059\u305f\u3081\u3001\u30d7\u30ed\u30f3\u30d7\u30c8\u304c\u5909\u66f4\u3055\u308c\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u8868\u793a\u306b\u306a\u308a\u307e\u3059\uff1a\uff08myprojectenv\uff09user@host:~\/myproject$\u3002<\/p>\n<h2>\u30b9\u30c6\u30c3\u30d73 \u2014 Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/h2>\n<p>\u4eee\u60f3\u74b0\u5883\u306b\u5165\u3063\u3066\u3044\u308b\u306e\u3067\u3001Flask\u3068uWSGI\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30c7\u30b6\u30a4\u30f3\u306b\u53d6\u308a\u639b\u304b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u6700\u521d\u306b\u3001\u30db\u30a4\u30fc\u30eb\u30a2\u30fc\u30ab\u30a4\u30d6\u304c\u4e0d\u8db3\u3057\u3066\u3044\u3066\u3082\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u308b\u3088\u3046\u3001pip\u306e\u30ed\u30fc\u30ab\u30eb\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u30db\u30a4\u30fc\u30eb\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">pip <span class=\"token function\">install<\/span> wheel<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"post-conf-note\">\n<p class=\"post-conf-desc\">Note<\/p>\n<div>\u6ce8\u610f\uff1aPython\u306e\u3069\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u4f7f\u3063\u3066\u3044\u308b\u304b\u306b\u95a2\u4fc2\u306a\u304f\u3001\u4eee\u60f3\u74b0\u5883\u304c\u30a2\u30af\u30c6\u30a3\u30d6\u5316\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306f\u3001pip\u30b3\u30de\u30f3\u30c9\uff08pip3\u3067\u306f\u306a\u304f\uff09\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/div>\n<\/div>\n<p>\u6b21\u306b\u3001Flask\u3068uWSGI\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"(myprojectenv) $\">pip <span class=\"token function\">install<\/span> uwsgi flask<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<h3>\u30b5\u30f3\u30d7\u30eb\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3059\u308b\u3002<\/h3>\n<p>Flask\u304c\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u3067\u3001\u30b5\u30f3\u30d7\u30eb\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002Flask\u306f\u30de\u30a4\u30af\u30ed\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002\u3088\u308a\u591a\u6a5f\u80fd\u306a\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306b\u542b\u307e\u308c\u308b\u30c4\u30fc\u30eb\u306f\u591a\u304f\u3042\u308a\u307e\u305b\u3093\u3057\u3001\u4e3b\u306b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3066\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u521d\u671f\u5316\u3092\u30b5\u30dd\u30fc\u30c8\u3059\u308b\u305f\u3081\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3068\u3057\u3066\u5b58\u5728\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3042\u306a\u305f\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u3088\u308a\u8907\u96d1\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u3053\u306e\u4f8b\u3067\u306fFlask\u30a2\u30d7\u30ea\u30921\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u3001myproject.py\u3068\u3057\u3066\u4f5c\u6210\u3057\u307e\u3059\u3002nano\u307e\u305f\u306f\u304a\u6c17\u306b\u5165\u308a\u306e\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf\u3067myproject.py\u3092\u958b\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"(myprojectenv) $\"><span class=\"token function\">nano<\/span> ~\/<mark>myproject<\/mark>\/<mark>myproject<\/mark>.py<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30b3\u30fc\u30c9\u304c\u5b58\u5728\u3057\u307e\u3059\u3002Flask\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3001Flask\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u3057\u307e\u3059\u3002\u7279\u5b9a\u306e\u30eb\u30fc\u30c8\u304c\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u308c\u305f\u969b\u306b\u5b9f\u884c\u3057\u305f\u3044\u95a2\u6570\u3092\u5b9a\u7fa9\u3059\u308b\u305f\u3081\u306b\u3053\u308c\u3092\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n<div>~\/\u79c1\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\/\u79c1\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8.py<\/div>\n<pre class=\"post-pre\"><code><span class=\"token keyword\">from<\/span> flask <span class=\"token keyword\">import<\/span> Flask\r\napp <span class=\"token operator\">=<\/span> Flask<span class=\"token punctuation\">(<\/span>__name__<span class=\"token punctuation\">)<\/span>\r\n\r\n<span class=\"token decorator annotation punctuation\">@app<span class=\"token punctuation\">.<\/span>route<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">\"\/\"<\/span><span class=\"token punctuation\">)<\/span>\r\n<span class=\"token keyword\">def<\/span> <span class=\"token function\">hello<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span>\r\n    <span class=\"token keyword\">return<\/span> <span class=\"token string\">\"&lt;h1 style='color:blue'&gt;Hello There!&lt;\/h1&gt;\"<\/span>\r\n\r\n<span class=\"token keyword\">if<\/span> __name__ <span class=\"token operator\">==<\/span> <span class=\"token string\">\"__main__\"<\/span><span class=\"token punctuation\">:<\/span>\r\n    app<span class=\"token punctuation\">.<\/span>run<span class=\"token punctuation\">(<\/span>host<span class=\"token operator\">=<\/span><span class=\"token string\">'0.0.0.0'<\/span><span class=\"token punctuation\">)<\/span>\r\n<\/code><\/pre>\n<p>\u57fa\u672c\u7684\u306b\u3001\u3053\u308c\u306f\u30eb\u30fc\u30c8\u30c9\u30e1\u30a4\u30f3\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u4eba\u306b\u5bfe\u3057\u3066\u8868\u793a\u3059\u308b\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u5b9a\u7fa9\u3059\u308b\u3082\u306e\u3067\u3059\u3002\u7de8\u96c6\u304c\u7d42\u4e86\u3057\u305f\u3089\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3057\u3066\u9589\u3058\u3066\u304f\u3060\u3055\u3044\u3002\u524d\u306e\u4f8b\u3068\u540c\u69d8\u306b\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6\u3059\u308b\u305f\u3081\u306bnano\u3092\u4f7f\u7528\u3057\u305f\u5834\u5408\u306f\u3001CTRL + X\u3001Y\u3001\u305d\u3057\u3066ENTER\u30ad\u30fc\u3092\u62bc\u3057\u3066\u4fdd\u5b58\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u521d\u671f\u306e\u30b5\u30fc\u30d0\u30fc\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u30ac\u30a4\u30c9\u306b\u5f93\u3063\u305f\u5834\u5408\u3001UFW\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u304c\u6709\u52b9\u306b\u306a\u3063\u3066\u3044\u308b\u306f\u305a\u3067\u3059\u3002\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u30dd\u30fc\u30c85000\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u8a31\u53ef\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"(myprojectenv) $\"><span class=\"token function\">sudo<\/span> ufw allow <span class=\"token number\">5000<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4eca\u3001Flask\u30a2\u30d7\u30ea\u3092\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"(myprojectenv) $\">python <mark>myproject<\/mark>.py<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u6b21\u306e\u3088\u3046\u306a\u51fa\u529b\u3092\u898b\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u30b5\u30fc\u30d0\u30fc\u8a2d\u5b9a\u3092\u672c\u756a\u74b0\u5883\u3067\u306f\u4f7f\u7528\u3057\u306a\u3044\u3088\u3046\u306b\u3068\u306e\u6ce8\u610f\u66f8\u304d\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Serving Flask app &#8216;myproject&#8217; * Debug mode: off * Running on all addresses (0.0.0.0) WARNING: This is a development server. Do not use it in a production deployment. * Running on http:\/\/127.0.0.1:5000 * Running on http:\/\/<mark>your_server<\/mark>:5000 (Press CTRL+C to quit)<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u30a6\u30a7\u30d6\u30d6\u30e9\u30a6\u30b6\u3067\u3001\u30b5\u30fc\u30d0\u30fc\u306eIP\u30a2\u30c9\u30ec\u30b9\u306b\u7d9a\u3044\u3066\u300c:5000\u300d\u3068\u5165\u529b\u3057\u3066\u30a2\u30af\u30bb\u30b9\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code>http:\/\/<mark>your_server_ip<\/mark>:5000\r\n<\/code><\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u306e\u3082\u306e\u304c\u898b\u3048\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656474d2daa94e2bdf7b75c0\/51-0.png\" alt=\"Flask sample app\" \/><\/div>\n<p>Flask\u306e\u958b\u767a\u30b5\u30fc\u30d0\u30fc\u3092\u505c\u6b62\u3059\u308b\u306b\u306f\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u30a6\u30a3\u30f3\u30c9\u30a6\u3067CTRL + C\u3092\u62bc\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>WSGI\u30a8\u30f3\u30c8\u30ea\u30fc\u30dd\u30a4\u30f3\u30c8\u306e\u4f5c\u6210<\/h3>\n<p>\u6b21\u306b\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u30dd\u30a4\u30f3\u30c8\u3068\u306a\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001\u3042\u306a\u305f\u306euWSGI\u30b5\u30fc\u30d0\u30fc\u304c\u305d\u308c\u3068\u3084\u308a\u53d6\u308a\u3059\u308b\u65b9\u6cd5\u3092\u6307\u793a\u3057\u307e\u3059\u3002<\/p>\n<p>\u30d5\u30a1\u30a4\u30eb\u540d\u3092wsgi.py\u3068\u547c\u3093\u3067\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"(myprojectenv) $\"><span class=\"token function\">nano<\/span> ~\/<mark>myproject<\/mark>\/wsgi.py<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u3067\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089Flask\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3001\u305d\u308c\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\u300c~\/myproject\/wsgi.py\u300d\u3092\u65e5\u672c\u8a9e\u3067\u8a00\u3044\u63db\u3048\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\uff1a<br \/>\n\u300c~\/myproject\/wsgi.py\u300d<\/div>\n<pre class=\"post-pre\"><code><span class=\"token keyword\">from<\/span> myproject <span class=\"token keyword\">import<\/span> app\r\n\r\n<span class=\"token keyword\">if<\/span> __name__ <span class=\"token operator\">==<\/span> <span class=\"token string\">\"__main__\"<\/span><span class=\"token punctuation\">:<\/span>\r\n    app<span class=\"token punctuation\">.<\/span>run<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span>\r\n<\/code><\/pre>\n<p>\u4f5c\u696d\u304c\u7d42\u308f\u3063\u305f\u3089\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3057\u3066\u9589\u3058\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>\u30b9\u30c6\u30c3\u30d74 \u2014 uWSGI\u306e\u8a2d\u5b9a<\/h2>\n<p>\u3042\u306a\u305f\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u3001\u30a8\u30f3\u30c8\u30ea\u30fc\u30dd\u30a4\u30f3\u30c8\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002\u6b21\u306fuWSGI\u306e\u8a2d\u5b9a\u306b\u9032\u3080\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>\u300cuWSGI\u304c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3067\u304d\u308b\u304b\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b\u300d<\/h3>\n<p>\u6700\u521d\u306e\u30b9\u30c6\u30c3\u30d7\u3068\u3057\u3066\u3001uWSGI\u304c\u6b63\u3057\u304f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3067\u304d\u308b\u304b\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u3001\u30a8\u30f3\u30c8\u30ea\u30fc\u30dd\u30a4\u30f3\u30c8\u306e\u540d\u524d\u3092\u6e21\u3057\u3066\u30c6\u30b9\u30c8\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u306f\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u540d\u524d\uff08.py\u62e1\u5f35\u5b50\u3092\u9664\u304f\uff09\u3068\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5185\u306e\u547c\u3073\u51fa\u3057\u53ef\u80fd\u306a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u540d\u524d\u304b\u3089\u69cb\u6210\u3055\u308c\u307e\u3059\u3002\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306e\u6587\u8108\u3067\u306f\u3001\u30a8\u30f3\u30c8\u30ea\u30fc\u30dd\u30a4\u30f3\u30c8\u306e\u540d\u524d\u306fwsgi:app\u3067\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u4ee5\u524d\u306b\u958b\u3044\u305f\u30dd\u30fc\u30c8\u756a\u53f7\uff085000\u756a\uff09\u3092\u4f7f\u7528\u3057\u3001\u516c\u958b\u53ef\u80fd\u306a\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3067\u30bd\u30b1\u30c3\u30c8\u3092\u958b\u59cb\u3059\u308b\u3088\u3046\u306b\u6307\u5b9a\u3057\u3001uwsgi\u30d0\u30a4\u30ca\u30ea\u30d7\u30ed\u30c8\u30b3\u30eb\u306e\u4ee3\u308f\u308a\u306bHTTP\u3092\u4f7f\u7528\u3059\u308b\u30d7\u30ed\u30c8\u30b3\u30eb\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"(myprojectenv) $\">uwsgi <span class=\"token parameter variable\">&#8211;socket<\/span> <span class=\"token number\">0.0<\/span>.0.0:5000 <span class=\"token parameter variable\">&#8211;protocol<\/span><span class=\"token operator\">=<\/span>http <span class=\"token parameter variable\">-w<\/span> wsgi:app<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u518d\u3073\u30a6\u30a7\u30d6\u30d6\u30e9\u30a6\u30b6\u3067\u3001\u30b5\u30fc\u30d0\u30fc\u306eIP\u30a2\u30c9\u30ec\u30b9\u306e\u672b\u5c3e\u306b\u300c:5000\u300d\u3092\u4ed8\u3051\u3066\u30a2\u30af\u30bb\u30b9\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code>http:\/\/<mark>your_server_ip<\/mark>:5000\r\n<\/code><\/pre>\n<p>\u3042\u306a\u305f\u306f\u518d\u3073\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u51fa\u529b\u3092\u898b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656474d2daa94e2bdf7b75c0\/70-0.png\" alt=\"Flask sample app\" \/><\/div>\n<p>\u52d5\u4f5c\u304c\u6b63\u5e38\u306b\u78ba\u8a8d\u3067\u304d\u305f\u3089\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u30a6\u30a3\u30f3\u30c9\u30a6\u3067CTRL + C\u3092\u62bc\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3042\u306a\u305f\u306f\u4eca\u3001\u4eee\u60f3\u74b0\u5883\u3092\u7d42\u4e86\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"(myprojectenv) $\">deactivate<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4eca\u5f8c\u3001Python\u306e\u30b3\u30de\u30f3\u30c9\u306f\u518d\u3073\u30b7\u30b9\u30c6\u30e0\u306ePython\u74b0\u5883\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<h3>uWSGI\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b<\/h3>\n<p>uWSGI\u304c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3067\u304d\u308b\u3053\u3068\u3092\u30c6\u30b9\u30c8\u3057\u307e\u3057\u305f\u304c\u3001\u9577\u671f\u5229\u7528\u306b\u306f\u3055\u3089\u306b\u5805\u7262\u306a\u3082\u306e\u304c\u5fc5\u8981\u3067\u3059\u3002\u3053\u308c\u306b\u9069\u3057\u305fuWSGI\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3042\u306a\u305f\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u305d\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u914d\u7f6e\u3057\u3001\u300cmyproject.ini\u300d\u3068\u547c\u3093\u3067\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">nano<\/span> ~\/<mark>myproject<\/mark>\/<mark>myproject<\/mark>.ini<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u30d5\u30a1\u30a4\u30eb\u306e\u4e2d\u3067\u3001[uwsgi]\u30d8\u30c3\u30c0\u30fc\u3067\u958b\u59cb\u3057\u3001uWSGI\u304c\u8a2d\u5b9a\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u3092\u77e5\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002\u305d\u306e\u4e0b\u306b\u3001\u62e1\u5f35\u5b50\u3092\u9664\u3044\u305fwsgi.py\u30d5\u30a1\u30a4\u30eb\u81ea\u4f53\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u5185\u306e\u547c\u3073\u51fa\u3057\u53ef\u80fd\u306a\u3082\u306e\u3067\u3042\u308bapp\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\u79c1\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3001~\/myproject\/myproject.ini<\/div>\n<pre class=\"post-pre\"><code>[uwsgi]\r\nmodule = wsgi:app\r\n<\/code><\/pre>\n<p>\u6b21\u306b\u3001uWSGI\u306b\u30de\u30b9\u30bf\u30fc\u30e2\u30fc\u30c9\u3067\u8d77\u52d5\u3057\u3001\u5b9f\u969b\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u51e6\u7406\u3059\u308b\u305f\u3081\u306b5\u3064\u306e\u30ef\u30fc\u30ab\u30fc\u30d7\u30ed\u30bb\u30b9\u3092\u751f\u6210\u3059\u308b\u3088\u3046\u306b\u6307\u793a\u3057\u307e\u3059\u3002<\/p>\n<div>\u300c~\/myproject\/myproject.ini\u300d<\/div>\n<pre class=\"post-pre\"><code>[uwsgi]\r\nmodule = wsgi:app\r\n\r\nmaster = true\r\nprocesses = 5\r\n<\/code><\/pre>\n<p>\u3042\u306a\u305f\u304c\u30c6\u30b9\u30c8\u3057\u3066\u3044\u308b\u3068\u304d\u3001uWSGI\u3092\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30dd\u30fc\u30c8\u3067\u516c\u958b\u3057\u307e\u3057\u305f\u3002\u3057\u304b\u3057\u3001\u5b9f\u969b\u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u63a5\u7d9a\u306fNginx\u3092\u4f7f\u7528\u3057\u3001\u305d\u308c\u304b\u3089\u30ea\u30af\u30a8\u30b9\u30c8\u3092uWSGI\u306b\u6e21\u3057\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u540c\u3058\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u4e0a\u3067\u52d5\u4f5c\u3057\u3066\u3044\u308b\u305f\u3081\u3001Unix\u30bd\u30b1\u30c3\u30c8\u3092\u4f7f\u7528\u3059\u308b\u65b9\u304c\u901f\u304f\u3001\u5b89\u5168\u3067\u3059\u3002\u30bd\u30b1\u30c3\u30c8\u3092myproject.sock\u3068\u547c\u3073\u3001\u3053\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u914d\u7f6e\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u6b21\u306b\u3001\u30bd\u30b1\u30c3\u30c8\u306e\u6a29\u9650\u3092\u5909\u66f4\u3057\u307e\u3059\u3002\u5f8c\u3067Nginx\u30b0\u30eb\u30fc\u30d7\u304cuWSGI\u30d7\u30ed\u30bb\u30b9\u306e\u6240\u6709\u6a29\u3092\u6301\u3064\u3053\u3068\u306b\u306a\u308b\u306e\u3067\u3001\u30bd\u30b1\u30c3\u30c8\u306e\u30b0\u30eb\u30fc\u30d7\u6240\u6709\u8005\u304c\u60c5\u5831\u3092\u8aad\u307f\u53d6\u308a\u3001\u66f8\u304d\u8fbc\u307f\u3067\u304d\u308b\u3088\u3046\u306b\u78ba\u8a8d\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u307e\u305f\u3001vacuum\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3057\u3001true\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30d7\u30ed\u30bb\u30b9\u304c\u505c\u6b62\u3057\u305f\u969b\u306b\u30bd\u30b1\u30c3\u30c8\u3092\u30af\u30ea\u30fc\u30f3\u30a2\u30c3\u30d7\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<div>\uff5e\/\u30de\u30a4\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\/\u30de\u30a4\u30d7\u30ed\u30b8\u30a7\u30af\u30c8.ini<\/div>\n<pre class=\"post-pre\"><code>[uwsgi]\r\nmodule = wsgi:app\r\n\r\nmaster = true\r\nprocesses = 5\r\n\r\nsocket = <mark>myproject<\/mark>.sock\r\nchmod-socket = 660\r\nvacuum = true\r\n<\/code><\/pre>\n<p>\u6700\u5f8c\u306b\u884c\u3046\u3079\u304d\u3053\u3068\u306f\u3001die-on-term\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001init\u30b7\u30b9\u30c6\u30e0\u3068uWSGI\u304c\u5404\u30d7\u30ed\u30bb\u30b9\u30b7\u30b0\u30ca\u30eb\u306b\u3064\u3044\u3066\u540c\u3058\u524d\u63d0\u3092\u6301\u3064\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u30012\u3064\u306e\u30b7\u30b9\u30c6\u30e0\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u4e00\u81f4\u3057\u3001\u671f\u5f85\u3055\u308c\u308b\u52d5\u4f5c\u304c\u5b9f\u88c5\u3055\u308c\u307e\u3059\u3002<\/p>\n<div>\u79c1\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8.ini\u30d5\u30a1\u30a4\u30eb<\/div>\n<pre class=\"post-pre\"><code>[uwsgi]\r\nmodule = wsgi:app\r\n\r\nmaster = true\r\nprocesses = 5\r\n\r\nsocket = <mark>myproject<\/mark>.sock\r\nchmod-socket = 660\r\nvacuum = true\r\n\r\ndie-on-term = true\r\n<\/code><\/pre>\n<p>\u300c\u304a\u6c17\u3065\u304d\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u3053\u308c\u3089\u306e\u884c\u306f\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u304b\u3089\u6307\u5b9a\u3057\u305f\u3088\u3046\u306a\u30d7\u30ed\u30c8\u30b3\u30eb\u3092\u7279\u5b9a\u3057\u3066\u3044\u307e\u305b\u3093\u3002\u305d\u308c\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306fuWSGI\u304cuwsgi\u30d7\u30ed\u30c8\u30b3\u30eb\u3092\u4f7f\u7528\u3057\u3066\u901a\u4fe1\u3059\u308b\u305f\u3081\u3067\u3059\u3002uwsgi\u306f\u4ed6\u306e\u30b5\u30fc\u30d0\u30fc\u3068\u901a\u4fe1\u3059\u308b\u305f\u3081\u306b\u8a2d\u8a08\u3055\u308c\u305f\u9ad8\u901f\u30d0\u30a4\u30ca\u30ea\u30d7\u30ed\u30c8\u30b3\u30eb\u3067\u3059\u3002Nginx\u306f\u3053\u306e\u30d7\u30ed\u30c8\u30b3\u30eb\u3092\u30cd\u30a4\u30c6\u30a3\u30d6\u306b\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u308b\u305f\u3081\u3001HTTP\u306b\u3088\u308b\u5f37\u5236\u901a\u4fe1\u3088\u308a\u3082\u3053\u308c\u3092\u4f7f\u7528\u3059\u308b\u65b9\u304c\u826f\u3044\u3067\u3059\u3002\u300d<\/p>\n<p>\u4f5c\u696d\u304c\u7d42\u4e86\u3057\u305f\u3089\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3057\u3066\u9589\u3058\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u305d\u308c\u306b\u3088\u308a\u3001uWSGI\u306f\u30b7\u30b9\u30c6\u30e0\u306b\u8a2d\u5b9a\u3055\u308c\u307e\u3059\u3002Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u7ba1\u7406\u65b9\u6cd5\u306b\u3088\u308a\u67d4\u8edf\u6027\u3092\u6301\u305f\u305b\u308b\u305f\u3081\u3001\u305d\u308c\u3092systemd\u30b5\u30fc\u30d3\u30b9\u3068\u3057\u3066\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>Step 5 \u2014 systemd\u306e\u30e6\u30cb\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b<\/h2>\n<p>Systemd\u306f\u3001\u30b7\u30b9\u30c6\u30e0\u30b5\u30fc\u30d3\u30b9\u306e\u7ba1\u7406\u306b\u9ad8\u901f\u304b\u3064\u67d4\u8edf\u306ainit\u30e2\u30c7\u30eb\u3092\u63d0\u4f9b\u3059\u308b\u30c4\u30fc\u30eb\u306e\u30b9\u30a4\u30fc\u30c8\u3067\u3059\u3002systemd\u30e6\u30cb\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3068\u3001Ubuntu\u306einit\u30b7\u30b9\u30c6\u30e0\u306f\u3001\u30b5\u30fc\u30d0\u30fc\u30d6\u30fc\u30c8\u6642\u306b\u81ea\u52d5\u7684\u306buWSGI\u3092\u8d77\u52d5\u3057\u3066Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002<\/p>\n<p>\u300c\/etc\/systemd\/system\u300d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306b\u62e1\u5f35\u5b50\u304c\u300c.service\u300d\u3067\u7d42\u308f\u308b\u30e6\u30cb\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u3001\u59cb\u3081\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">nano<\/span> \/etc\/systemd\/system\/<mark>myproject<\/mark>.service<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u30a4\u30f3\u30b5\u30a4\u30c9\u3067\u306f\u3001\u30e1\u30bf\u30c7\u30fc\u30bf\u3068\u4f9d\u5b58\u95a2\u4fc2\u3092\u6307\u5b9a\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u308b\u300c[Unit]\u300d\u30bb\u30af\u30b7\u30e7\u30f3\u3092\u958b\u59cb\u3057\u307e\u3059\u3002\u305d\u306e\u5f8c\u3001\u3053\u3053\u306b\u30b5\u30fc\u30d3\u30b9\u306e\u8aac\u660e\u3092\u8a18\u8f09\u3057\u3001\u30cd\u30c3\u30c8\u30ef\u30fc\u30ad\u30f3\u30b0\u30bf\u30fc\u30b2\u30c3\u30c8\u306b\u5230\u9054\u5f8c\u306b\u306e\u307f\u3001\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30ba\u30b7\u30b9\u30c6\u30e0\u306b\u8d77\u52d5\u3055\u308c\u308b\u3088\u3046\u6307\u793a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\u79c1\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30b5\u30fc\u30d3\u30b9\u306f\u3001\/etc\/systemd\/system\/myproject.service\u306b\u3042\u308a\u307e\u3059\u3002<\/div>\n<pre class=\"post-pre\"><code>[Unit]\r\nDescription=uWSGI instance to serve <mark>myproject<\/mark>\r\nAfter=network.target\r\n<\/code><\/pre>\n<p>\u6b21\u306b\u3001[Service] \u30bb\u30af\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001\u30d7\u30ed\u30bb\u30b9\u3092\u5b9f\u884c\u3059\u308b\u30e6\u30fc\u30b6\u30fc\u3068\u30b0\u30eb\u30fc\u30d7\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u95a2\u9023\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u3059\u3079\u3066\u6240\u6709\u3059\u308b\u305f\u3081\u3001\u901a\u5e38\u306e\u30e6\u30fc\u30b6\u30fc\u30a2\u30ab\u30a6\u30f3\u30c8\u306b\u30d7\u30ed\u30bb\u30b9\u306e\u6240\u6709\u6a29\u3092\u4e0e\u3048\u307e\u3059\u3002\u6b21\u306b\u3001Nginx\u304cuWSGI\u30d7\u30ed\u30bb\u30b9\u3068\u901a\u4fe1\u3067\u304d\u308b\u3088\u3046\u306b\u3001www-data\u30b0\u30eb\u30fc\u30d7\u306b\u30b0\u30eb\u30fc\u30d7\u6240\u6709\u6a29\u3092\u4e0e\u3048\u307e\u3059\uff08\u3053\u308c\u306fUbuntu\u3067Nginx\u304c\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u5b9f\u884c\u3055\u308c\u308b\u30b0\u30eb\u30fc\u30d7\u3067\u3059\uff09\u3002\u3053\u3053\u3067\u306f\u3054\u81ea\u8eab\u306e\u30e6\u30fc\u30b6\u30fc\u540d\u306b\u7f6e\u304d\u63db\u3048\u308b\u3053\u3068\u3092\u5fd8\u308c\u306a\u3044\u3067\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\u79c1\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30b5\u30fc\u30d3\u30b9\u306f\u3001\/etc\/systemd\/system\/myproject.service\u3067\u3059\u3002<\/div>\n<pre class=\"post-pre\"><code>[Unit]\r\nDescription=uWSGI instance to serve <mark>myproject<\/mark>\r\nAfter=network.target\r\n\r\n[Service]\r\nUser=<mark>sammy<\/mark>\r\nGroup=www-data\r\n<\/code><\/pre>\n<p>\u6b21\u306b\u3001\u4f5c\u696d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u30de\u30c3\u30d4\u30f3\u30b0\u3057\u3001\u30d7\u30ed\u30bb\u30b9\u306e\u5b9f\u884c\u53ef\u80fd\u30d5\u30a1\u30a4\u30eb\u304c\u4eee\u60f3\u74b0\u5883\u5185\u306b\u5b58\u5728\u3059\u308b\u3053\u3068\u3092\u521d\u671f\u5316\u30b7\u30b9\u30c6\u30e0\u304c\u8a8d\u8b58\u3067\u304d\u308b\u3088\u3046\u306b\u3001PATH\u74b0\u5883\u5909\u6570\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u307e\u305f\u3001\u30b5\u30fc\u30d3\u30b9\u3092\u8d77\u52d5\u3059\u308b\u305f\u3081\u306e\u30b3\u30de\u30f3\u30c9\u3082\u6307\u5b9a\u3057\u307e\u3059\u3002Systemd\u3067\u306f\u3001uWSGI\u306e\u5b9f\u884c\u53ef\u80fd\u30d5\u30a1\u30a4\u30eb\u306e\u30d5\u30eb\u30d1\u30b9\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u3053\u308c\u306f\u4eee\u60f3\u74b0\u5883\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u4f5c\u6210\u3057\u305f.ini\u69cb\u6210\u30d5\u30a1\u30a4\u30eb\u306e\u540d\u524d\u3092\u6e21\u3057\u307e\u3059\u3002<\/p>\n<p>\u30e6\u30fc\u30b6\u30fc\u540d\u3084\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30d1\u30b9\u3092\u3001\u3054\u81ea\u8eab\u306e\u60c5\u5831\u3067\u7f6e\u304d\u63db\u3048\u308b\u3053\u3068\u3092\u5fd8\u308c\u306a\u3044\u3067\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u65e5\u672c\u8a9e\u3067\u81ea\u7136\u306b\u8a00\u3044\u63db\u3048\u3066\u304f\u3060\u3055\u3044\u3002\u4e00\u3064\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u69cb\u3044\u307e\u305b\u3093\uff1a<br \/>\n\u300c\/etc\/systemd\/system\/myproject.service\u300d<\/div>\n<pre class=\"post-pre\"><code>[Unit]\r\nDescription=uWSGI instance to serve <mark>myproject<\/mark>\r\nAfter=network.target\r\n\r\n[Service]\r\nUser=<mark>sammy<\/mark>\r\nGroup=www-data\r\nWorkingDirectory=\/home\/<mark>sammy<\/mark>\/<mark>myproject<\/mark>\r\nEnvironment=\"PATH=\/home\/<mark>sammy<\/mark>\/<mark>myproject<\/mark>\/<mark>myprojectenv<\/mark>\/bin\"\r\nExecStart=\/home\/<mark>sammy<\/mark>\/<mark>myproject<\/mark>\/<mark>myprojectenv<\/mark>\/bin\/uwsgi --ini <mark>myproject<\/mark>.ini\r\n<\/code><\/pre>\n<p>\u6700\u7d42\u7684\u306b\u3001[Install] \u30bb\u30af\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30b7\u30b9\u30c6\u30e0\u8d77\u52d5\u6642\u306b\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u6709\u52b9\u306b\u3059\u308b\u5834\u5408\u306b\u3001systemd\u304c\u3069\u306e\u3088\u3046\u306b\u30ea\u30f3\u30af\u3059\u308b\u304b\u304c\u6307\u5b9a\u3055\u308c\u307e\u3059\u3002\u3053\u306e\u5834\u5408\u3001\u901a\u5e38\u306e\u30de\u30eb\u30c1\u30e6\u30fc\u30b6\u30fc\u30b7\u30b9\u30c6\u30e0\u304c\u8d77\u52d5\u3057\u3066\u3044\u308b\u6642\u306b\u30b5\u30fc\u30d3\u30b9\u3092\u958b\u59cb\u3059\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\u4ee5\u4e0b\u306e\u6587\u3092\u65e5\u672c\u8a9e\u3067\u30d1\u30e9\u30d5\u30ec\u30fc\u30ba\u3057\u3066\u304f\u3060\u3055\u3044\u3001\u305f\u3060\u30571\u3064\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u5341\u5206\u3067\u3059\uff1a<br \/>\n\u300c\/etc\/systemd\/system\/myproject.service\u300d<\/div>\n<pre class=\"post-pre\"><code>[Unit]\r\nDescription=uWSGI instance to serve <mark>myproject<\/mark>\r\nAfter=network.target\r\n\r\n[Service]\r\nUser=<mark>sammy<\/mark>\r\nGroup=www-data\r\nWorkingDirectory=\/home\/<mark>sammy<\/mark>\/<mark>myproject<\/mark>\r\nEnvironment=\"PATH=\/home\/<mark>sammy<\/mark>\/<mark>myproject<\/mark>\/<mark>myprojectenv<\/mark>\/bin\"\r\nExecStart=\/home\/<mark>sammy<\/mark>\/<mark>myproject<\/mark>\/<mark>myprojectenv<\/mark>\/bin\/uwsgi --ini <mark>myproject<\/mark>.ini\r\n\r\n[Install]\r\nWantedBy=multi-user.target\r\n<\/code><\/pre>\n<p>\u305d\u308c\u306b\u3088\u308a\u3001\u3042\u306a\u305f\u306esystemd\u30b5\u30fc\u30d3\u30b9\u30d5\u30a1\u30a4\u30eb\u306f\u5b8c\u6210\u3067\u3059\u3002\u4eca\u4fdd\u5b58\u3057\u3066\u9589\u3058\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>uWSGI\u30b5\u30fc\u30d3\u30b9\u3092\u958b\u59cb\u3059\u308b\u524d\u306b\u3001Ubuntu 22.04\u4ee5\u964d\u3067\u306fNginx\u306ewww-data\u30e6\u30fc\u30b6\u30fc\u304c\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u30db\u30fc\u30e0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u3080\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u305f\u3081\u3001\u30a2\u30af\u30bb\u30b9\u6a29\u306e\u5909\u66f4\u304c\u5fc5\u8981\u3067\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30db\u30fc\u30e0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306e\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u63d0\u4f9b\u304c\u59a8\u3052\u3089\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\u7c21\u5358\u306a\u4fee\u6b63\u65b9\u6cd5\u306f\u3001chgrp\u3092\u4f7f\u7528\u3057\u3066\u30db\u30fc\u30e0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u30b0\u30eb\u30fc\u30d7\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">chgrp<\/span> www-data \/home\/sammy<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3053\u308c\u306b\u3088\u308a\u3001Nginx\u306f\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u3001\u3042\u306a\u305f\u306e\u30db\u30fc\u30e0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u5185\u5bb9\u3092\u898b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u3042\u306a\u305f\u306e\u30db\u30fc\u30e0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u30a6\u30a7\u30d6\u4e0a\u306b\u516c\u958b\u3055\u308c\u308b\u3053\u3068\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u4f5c\u6210\u3057\u305fuWSGI\u30b5\u30fc\u30d3\u30b9\u3092\u958b\u59cb\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> systemctl start <mark>myproject<\/mark><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u305d\u308c\u304b\u3089\u3001\u8d77\u52d5\u6642\u306b\u81ea\u52d5\u3067\u8d77\u52d5\u3059\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> systemctl <span class=\"token builtin class-name\">enable<\/span> <mark>myproject<\/mark><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u72b6\u6cc1\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> systemctl status <mark>myproject<\/mark><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u51fa\u529b\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u25cf myproject.service &#8211; uWSGI instance to serve myproject Loaded: loaded (\/etc\/systemd\/system\/myproject.service; enabled; vendor preset: ena&gt; Active: active (running) since Fri 2022-08-05 17:22:05 UTC; 6s ago Main PID: 4953 (uwsgi) Tasks: 6 (limit: 2327) Memory: 20.9M CPU: 241ms CGroup: \/system.slice\/myproject.service \u251c\u25004953 \/home\/sammy\/myproject\/myprojectenv\/bin\/uwsgi &#8211;ini myproject.ini \u251c\u25004954 \/home\/sammy\/myproject\/myprojectenv\/bin\/uwsgi &#8211;ini myproject.ini \u251c\u25004955 \/home\/sammy\/myproject\/myprojectenv\/bin\/uwsgi &#8211;ini myproject.ini \u251c\u25004956 \/home\/sammy\/myproject\/myprojectenv\/bin\/uwsgi &#8211;ini myproject.ini \u251c\u25004957 \/home\/sammy\/myproject\/myprojectenv\/bin\/uwsgi &#8211;ini myproject.ini \u2514\u25004958 \/home\/sammy\/myproject\/myprojectenv\/bin\/uwsgi &#8211;ini myproject.ini<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3082\u3057\u30a8\u30e9\u30fc\u304c\u3042\u3063\u305f\u5834\u5408\u306f\u3001\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u7d9a\u3051\u308b\u524d\u306b\u5fc5\u305a\u4fee\u6b63\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u305d\u3046\u3067\u306a\u3051\u308c\u3070\u3001Nginx\u306e\u8a2d\u5b9a\u3092\u884c\u3044\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u3092myproject.sock\u30bd\u30b1\u30c3\u30c8\u306b\u6e21\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u30b9\u30c6\u30c3\u30d76 &#8211; Nginx\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u30d7\u30ed\u30ad\u30b7\u306b\u8a2d\u5b9a\u3059\u308b<\/h2>\n<p>\u3042\u306a\u305f\u306euWSGI\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u306f\u73fe\u5728\u7a3c\u50cd\u4e2d\u3067\u3042\u308a\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u3067\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u5f85\u3063\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u30b9\u30c6\u30c3\u30d7\u3067\u306f\u3001Nginx\u3092\u8a2d\u5b9a\u3057\u3066uwsgi\u30d7\u30ed\u30c8\u30b3\u30eb\u3092\u4f7f\u7528\u3057\u3066Web\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u305d\u306e\u30bd\u30b1\u30c3\u30c8\u306b\u6e21\u3059\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u6700\u521d\u306b\u3001Nginx\u306e\u300csites-available\u300d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u65b0\u3057\u3044\u30b5\u30fc\u30d0\u30fc\u30d6\u30ed\u30c3\u30af\u69cb\u6210\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u3053\u306e\u30ac\u30a4\u30c9\u306e\u4ed6\u306e\u90e8\u5206\u3068\u4e00\u81f4\u3055\u305b\u308b\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u4f8b\u3067\u306f\u3053\u308c\u3092\u300cmyproject\u300d\u3068\u547c\u3073\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">nano<\/span> \/etc\/nginx\/sites-available\/<mark>myproject<\/mark><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u30b5\u30fc\u30d0\u30fc\u30d6\u30ed\u30c3\u30af\u3092\u958b\u3044\u3066\u3001Nginx\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30dd\u30fc\u30c880\u3092\u30ea\u30c3\u30b9\u30f3\u3055\u305b\u307e\u3059\u3002\u3055\u3089\u306b\u3001\u3053\u306e\u30d6\u30ed\u30c3\u30af\u3092\u30b5\u30fc\u30d0\u30fc\u306e\u30c9\u30e1\u30a4\u30f3\u540d\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u4f7f\u7528\u3059\u308b\u3088\u3046\u306b\u6307\u793a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\u300c\/etc\/nginx\/sites-available\/myproject\u300d\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb<\/div>\n<pre class=\"post-pre\"><code>server {\r\n    listen 80;\r\n    server_name <mark>your_domain<\/mark> www.<mark>your_domain<\/mark>;\r\n}\r\n<\/code><\/pre>\n<p>\u6b21\u306b\u3001\u3059\u3079\u3066\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u30de\u30c3\u30c1\u3059\u308b\u30ed\u30b1\u30fc\u30b7\u30e7\u30f3\u30d6\u30ed\u30c3\u30af\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\u3053\u306e\u30d6\u30ed\u30c3\u30af\u5185\u306b\u306f\u3001\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u306e\u3042\u308b\u4e00\u822c\u7684\u306auWSGI\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6307\u5b9a\u3059\u308buwsgi_params\u30d5\u30a1\u30a4\u30eb\u3092\u542b\u3081\u307e\u3059\u3002\u305d\u306e\u5f8c\u3001uwsgi_pass\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3092\u4f7f\u7528\u3057\u3066\u3001\u5b9a\u7fa9\u3057\u305f\u30bd\u30b1\u30c3\u30c8\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u6e21\u3057\u307e\u3059\u3002<\/p>\n<div>\u79c1\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u5834\u6240\u306f\u3001\/etc\/nginx\/sites-available\/myproject\u3067\u3059\u3002<\/div>\n<pre class=\"post-pre\"><code>server {\r\n    listen 80;\r\n    server_name <mark>your_domain<\/mark> www.<mark>your_domain<\/mark>;\r\n\r\n    location \/ {\r\n        include uwsgi_params;\r\n        uwsgi_pass unix:\/home\/<mark>sammy<\/mark>\/<mark>myproject<\/mark>\/<mark>myproject<\/mark>.sock;\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>\u4f5c\u696d\u304c\u7d42\u308f\u3063\u305f\u3089\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3057\u3066\u9589\u3058\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u4f5c\u6210\u3057\u305fNginx\u30b5\u30fc\u30d0\u30fc\u30d6\u30ed\u30c3\u30af\u306e\u8a2d\u5b9a\u3092\u6709\u52b9\u306b\u3059\u308b\u305f\u3081\u306b\u3001\u30d5\u30a1\u30a4\u30eb\u3092sites-enabled\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u30ea\u30f3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">ln<\/span> <span class=\"token parameter variable\">-s<\/span> \/etc\/nginx\/sites-available\/<mark>myproject<\/mark> \/etc\/nginx\/sites-enabled<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>Nginx\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u969b\u3001\u30d7\u30ed\u30bb\u30b9\u306f\u81ea\u52d5\u7684\u306b\u30b5\u30fc\u30d0\u30fc\u30d6\u30ed\u30c3\u30af\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308bdefault\u3092sites-available\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u4f5c\u6210\u3057\u3001\u305d\u306e\u30d5\u30a1\u30a4\u30eb\u3068sites-enabled\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u9593\u306b\u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u30ea\u30f3\u30af\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002\u3053\u306e\u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u30ea\u30f3\u30af\u3092\u305d\u306e\u307e\u307e\u306b\u3057\u3066\u304a\u304f\u3068\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u8a2d\u5b9a\u306b\u3088\u308a\u30b5\u30a4\u30c8\u304c\u8aad\u307f\u8fbc\u307e\u308c\u306a\u304f\u306a\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066\u30ea\u30f3\u30af\u3092\u524a\u9664\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> unlink \/etc\/nginx\/sites-enabled\/default<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u305d\u306e\u5f8c\u3001\u6b21\u306e\u3088\u3046\u306b\u5165\u529b\u3057\u3066\u69cb\u6587\u30a8\u30e9\u30fc\u3092\u30c6\u30b9\u30c8\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> nginx <span class=\"token parameter variable\">-t<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3082\u3057\u4f55\u3082\u554f\u984c\u304c\u306a\u3044\u307e\u307e\u623b\u3063\u3066\u304d\u305f\u5834\u5408\u3001\u65b0\u3057\u3044\u8a2d\u5b9a\u3092\u8aad\u307f\u8fbc\u3080\u305f\u3081\u306bNginx\u30d7\u30ed\u30bb\u30b9\u3092\u518d\u8d77\u52d5\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> systemctl restart nginx<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u6700\u7d42\u7684\u306b\u3001\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u3092\u518d\u5ea6\u8abf\u6574\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u30dd\u30fc\u30c85000\u3092\u4ecb\u3057\u305f\u30a2\u30af\u30bb\u30b9\u306f\u3082\u3046\u5fc5\u8981\u306a\u3044\u306e\u3067\u3001\u305d\u306e\u30eb\u30fc\u30eb\u3092\u524a\u9664\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u305d\u3057\u3066\u3001Nginx\u30b5\u30fc\u30d0\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u8a31\u53ef\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> ufw delete allow <span class=\"token number\">5000<\/span><\/li>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> ufw allow <span class=\"token string\">&#8216;Nginx Full&#8217;<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4eca\u5f8c\u3001\u30a6\u30a7\u30d6\u30d6\u30e9\u30a6\u30b6\u3067\u30b5\u30fc\u30d0\u30fc\u306e\u30c9\u30e1\u30a4\u30f3\u540d\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>http:\/\/<mark>your_domain<\/mark>\r\n<\/code><\/pre>\n<p>\u3042\u306a\u305f\u306f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u51fa\u529b\u3092\u898b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656474d2daa94e2bdf7b75c0\/149-0.png\" alt=\"Flask sample app\" \/><\/div>\n<p>\u3082\u3057\u4f55\u304b\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u3089\u3001\u4ee5\u4e0b\u306e\u70b9\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<ul class=\"post-ul\">\n<li>sudo less \/var\/log\/nginx\/error.log: checks the Nginx error logs.<\/li>\n<li>sudo less \/var\/log\/nginx\/access.log: checks the Nginx access logs.<\/li>\n<li>sudo journalctl -u nginx: checks the Nginx process logs.<\/li>\n<li>sudo journalctl -u myproject: checks your Flask app\u2019s uWSGI logs.<\/li>\n<\/ul>\n<h2>\u30b9\u30c6\u30c3\u30d77 \u2014 \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u78ba\u4fdd<\/h2>\n<p>\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\u306e\u5b89\u5168\u6027\u3092\u78ba\u4fdd\u3059\u308b\u305f\u3081\u306b\u3001\u30c9\u30e1\u30a4\u30f3\u306e\u305f\u3081\u306bSSL\u8a3c\u660e\u66f8\u3092\u53d6\u5f97\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u306e\u305f\u3081\u306b\u306f\u3001\u3044\u304f\u3064\u304b\u306e\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002Let&#8217;s Encrypt\u304b\u3089\u7121\u6599\u306e\u8a3c\u660e\u66f8\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3001\u81ea\u5df1\u7f72\u540d\u8a3c\u660e\u66f8\u3092\u751f\u6210\u3059\u308b\u65b9\u6cd5\u3001\u307e\u305f\u306f\u5546\u696d\u30d7\u30ed\u30d0\u30a4\u30c0\u30fc\u304b\u3089\u8cfc\u5165\u3059\u308b\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001\u6642\u9593\u306e\u77ed\u7e2e\u306e\u305f\u3081\u306b\u3001Let&#8217;s Encrypt\u304b\u3089\u7121\u6599\u306e\u8a3c\u660e\u66f8\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<p>\u6700\u521d\u306b\u3001apt\u3092\u4f7f\u7528\u3057\u3066Certbot\u3068\u305d\u306eNginx\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> <span class=\"token function\">install<\/span> certbot python3-certbot-nginx<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>Certbot\u306f\u3001\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u901a\u3058\u3066\u69d8\u3005\u306a\u65b9\u6cd5\u3067SSL\u8a3c\u660e\u66f8\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002Nginx\u30d7\u30e9\u30b0\u30a4\u30f3\u306f\u3001\u5fc5\u8981\u306a\u5834\u5408\u306bNginx\u306e\u518d\u8a2d\u5b9a\u3068\u69cb\u6210\u306e\u30ea\u30ed\u30fc\u30c9\u3092\u81ea\u52d5\u3067\u884c\u3044\u307e\u3059\u3002\u3053\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u7528\u3059\u308b\u306b\u306f\u3001\u4ee5\u4e0b\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> certbot <span class=\"token parameter variable\">&#8211;nginx<\/span> <span class=\"token parameter variable\">-d<\/span> <mark>your_domain<\/mark> <span class=\"token parameter variable\">-d<\/span> www.<mark>your_domain<\/mark><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u306b\u8a00\u3044\u63db\u3048\u307e\u3059\uff08\u4e00\u3064\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u307f\uff09\uff1a<br \/>\n\u3053\u306e\u30b3\u30de\u30f3\u30c9\u306f\u3001&#8211;nginx\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u7528\u3057\u3066certbot\u3092\u5b9f\u884c\u3057\u3001-d\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u3063\u3066\u3001\u8a3c\u660e\u66f8\u304c\u6709\u52b9\u3067\u3042\u308b\u3068\u5e0c\u671b\u3059\u308b\u540d\u524d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\u3082\u3057\u30b5\u30fc\u30d0\u30fc\u3067certbot\u3092\u521d\u3081\u3066\u5b9f\u884c\u3059\u308b\u5834\u5408\u3001\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306e\u5165\u529b\u3068\u5229\u7528\u898f\u7d04\u3078\u306e\u540c\u610f\u3092\u6c42\u3081\u3089\u308c\u307e\u3059\u3002\u305d\u308c\u3092\u884c\u3063\u305f\u5f8c\u3001certbot\u306fLet&#8217;s Encrypt\u30b5\u30fc\u30d0\u30fc\u3068\u901a\u4fe1\u3057\u3001\u30c9\u30e1\u30a4\u30f3\u306e\u6240\u6709\u6a29\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306e\u30c1\u30e3\u30ec\u30f3\u30b8\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<p>\u8a2d\u5b9a\u304c\u66f4\u65b0\u3055\u308c\u3001Nginx\u306f\u65b0\u3057\u3044\u8a2d\u5b9a\u3092\u8aad\u307f\u8fbc\u3080\u305f\u3081\u306b\u30ea\u30ed\u30fc\u30c9\u3055\u308c\u307e\u3059\u3002certbot\u306f\u3001\u30d7\u30ed\u30bb\u30b9\u304c\u6210\u529f\u3057\u305f\u3053\u3068\u3068\u8a3c\u660e\u66f8\u304c\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u5834\u6240\u3092\u793a\u3059\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u5b8c\u4e86\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>Successfully received certificate. Certificate is saved at: \/etc\/letsencrypt\/live\/<mark>your_domain<\/mark>\/fullchain.pem Key is saved at: \/etc\/letsencrypt\/live\/<mark>your_domain<\/mark>\/privkey.pem This certificate expires on 2022-11-03. These files will be updated when the certificate renews. Certbot has set up a scheduled task to automatically renew this certificate in the background. Deploying certificate Successfully deployed certificate for <mark>your_domain<\/mark> to \/etc\/nginx\/sites-enabled\/myproject Successfully deployed certificate for <mark>your_domain<\/mark> to \/etc\/nginx\/sites-enabled\/myproject Congratulations! You have successfully enabled HTTPS on https:\/\/<mark>your_domain<\/mark> and https:\/\/www.<mark>your_domain<\/mark> &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; If you like Certbot, please consider supporting our work by: * Donating to ISRG \/ Let&#8217;s Encrypt: https:\/\/letsencrypt.org\/donate * Donating to EFF: https:\/\/eff.org\/donate-le &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211; &#8211;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3082\u3057\u3001\u524d\u63d0\u6761\u4ef6\u306eNginx\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u624b\u9806\u306b\u5f93\u3063\u3066\u3044\u308c\u3070\u3001\u3082\u3046\u5197\u9577\u306aHTTP\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u7ba1\u7406\u8a31\u5bb9\u304c\u5fc5\u8981\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> ufw delete allow <span class=\"token string\">&#8216;Nginx HTTP&#8217;<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u8a2d\u5b9a\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u3001\u518d\u3073https:\/\/\u3092\u4f7f\u7528\u3057\u3066\u30c9\u30e1\u30a4\u30f3\u306b\u79fb\u52d5\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code>https:\/\/<mark>your_domain<\/mark>\r\n<\/code><\/pre>\n<p>\u3042\u306a\u305f\u306f\u7533\u8acb\u306e\u7d50\u679c\u3092\u518d\u5ea6\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002\u307e\u305f\u3001\u30d6\u30e9\u30a6\u30b6\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc\u3082\u8868\u793a\u3055\u308c\u3001\u305d\u308c\u306b\u3088\u3063\u3066\u30b5\u30a4\u30c8\u304c\u5b89\u5168\u3067\u3042\u308b\u3053\u3068\u304c\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2>\u7d50\u8ad6<\/h2>\n<p>\u3053\u306e\u30ac\u30a4\u30c9\u3067\u306f\u3001Python\u306e\u4eee\u60f3\u74b0\u5883\u5185\u3067Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3057\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3092\u78ba\u4fdd\u3057\u307e\u3057\u305f\u3002\u305d\u308c\u304b\u3089\u3001\u4efb\u610f\u306eWSGI\u5bfe\u5fdc\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u304c\u3053\u308c\u3068\u9023\u643a\u3067\u304d\u308b\u3088\u3046\u306b\u3001WSGI\u30a8\u30f3\u30c8\u30ea\u30fc\u30dd\u30a4\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u3001uWSGI\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u3092\u69cb\u6210\u3057\u307e\u3057\u305f\u3002\u305d\u306e\u5f8c\u3001\u30b7\u30b9\u30c6\u30e0\u8d77\u52d5\u6642\u306b\u81ea\u52d5\u7684\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u3092\u8d77\u52d5\u3059\u308b\u305f\u3081\u306esystemd\u30b5\u30fc\u30d3\u30b9\u30d5\u30a1\u30a4\u30eb\u3082\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002\u307e\u305f\u3001\u5916\u90e8\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u4e2d\u7d99\u3057\u3001\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\u3092Let&#8217;s Encrypt\u3067\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5f37\u5316\u3059\u308b\u305f\u3081\u306b\u3001Nginx\u306e\u30b5\u30fc\u30d0\u30fc\u30d6\u30ed\u30c3\u30af\u3082\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>Flask\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u6a5f\u80fd\u6027\u3092\u5236\u9650\u305b\u305a\u306b\u3001\u67d4\u8edf\u6027\u306e\u3042\u308b\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002\u3053\u306e\u30ac\u30a4\u30c9\u3067\u8aac\u660e\u3055\u308c\u3066\u3044\u308b\u30b9\u30bf\u30c3\u30af\u3092\u4f7f\u7528\u3057\u3066\u3001\u8a2d\u8a08\u3057\u305fFlask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u65e5\u672c\u8a9e\u3067\u81ea\u7136\u306a\u8a00\u3044\u56de\u3057\u306b\u8a00\u3044\u63db\u3048\u3066\u304f\u3060\u3055\u3044\u3002\u4e00\u3064\u306e\u9078\u629e\u80a2\u3067\u69cb\u3044\u307e\u305b\u3093\u3002 \u30a4\u30f3\u30c8\u30ed\u30c0\u30af\u30b7\u30e7\u30f3 \u3053\u306e\u30ac\u30a4\u30c9\u3067\u306f\u3001Ubuntu 22.04\u4e0a\u3067Flask\u30de\u30a4\u30af\u30ed\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u4f7f\u7528\u3057\u3066Python\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092 [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,26],"class_list":["post-223","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-linux","tag-26"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Ubuntu 22.04\u306b\u304a\u3044\u3066\u3001uWSGI\u3068Nginx\u3092\u4f7f\u7528\u3057\u3066Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u65b9\u6cd5\u3002 - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"Ubuntu 22.04\u306b\u304a\u3044\u3066uWSGI\u3068Nginx\u3092\u4f7f\u7528\u3057\u3066Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04\u306b\u304a\u3044\u3066\u3001uwsgi\u3068nginx\u3092\u4f7f\u7528\u3057\u3066flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ubuntu 22.04\u306b\u304a\u3044\u3066\u3001uWSGI\u3068Nginx\u3092\u4f7f\u7528\u3057\u3066Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u65b9\u6cd5\u3002\" \/>\n<meta property=\"og:description\" content=\"Ubuntu 22.04\u306b\u304a\u3044\u3066uWSGI\u3068Nginx\u3092\u4f7f\u7528\u3057\u3066Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04\u306b\u304a\u3044\u3066\u3001uwsgi\u3068nginx\u3092\u4f7f\u7528\u3057\u3066flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-21T10:03:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-31T12:47:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656474d2daa94e2bdf7b75c0\/51-0.png\" \/>\n<meta name=\"author\" content=\"\u82bd\u4f9d, \u96e8\u591c\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u82bd\u4f9d, \u96e8\u591c\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"37\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%ab%e3%81%8a%e3%81%84%e3%81%a6%e3%80%81uwsgi%e3%81%a8nginx%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6flask%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%ab%e3%81%8a%e3%81%84%e3%81%a6%e3%80%81uwsgi%e3%81%a8nginx%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6flask%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3\/\",\"name\":\"Ubuntu 22.04\u306b\u304a\u3044\u3066\u3001uWSGI\u3068Nginx\u3092\u4f7f\u7528\u3057\u3066Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u65b9\u6cd5\u3002 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2023-05-21T10:03:22+00:00\",\"dateModified\":\"2025-07-31T12:47:06+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/aeb60a7861f2f002b54c66bd65bc6c27\"},\"description\":\"Ubuntu 22.04\u306b\u304a\u3044\u3066uWSGI\u3068Nginx\u3092\u4f7f\u7528\u3057\u3066Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%ab%e3%81%8a%e3%81%84%e3%81%a6%e3%80%81uwsgi%e3%81%a8nginx%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6flask%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%ab%e3%81%8a%e3%81%84%e3%81%a6%e3%80%81uwsgi%e3%81%a8nginx%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6flask%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%ab%e3%81%8a%e3%81%84%e3%81%a6%e3%80%81uwsgi%e3%81%a8nginx%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6flask%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Ubuntu 22.04\u306b\u304a\u3044\u3066\u3001uWSGI\u3068Nginx\u3092\u4f7f\u7528\u3057\u3066Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u65b9\u6cd5\u3002\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/aeb60a7861f2f002b54c66bd65bc6c27\",\"name\":\"\u82bd\u4f9d, \u96e8\u591c\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6305fe5cabc2b854c1208975a47fbf3f8cef3f7cd775b94dceedbe59b74a8010?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6305fe5cabc2b854c1208975a47fbf3f8cef3f7cd775b94dceedbe59b74a8010?s=96&d=mm&r=g\",\"caption\":\"\u82bd\u4f9d, \u96e8\u591c\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/meiamaya\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%ab%e3%81%8a%e3%81%84%e3%81%a6%e3%80%81uwsgi%e3%81%a8nginx%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6flask%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Ubuntu 22.04\u306b\u304a\u3044\u3066\u3001uWSGI\u3068Nginx\u3092\u4f7f\u7528\u3057\u3066Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u65b9\u6cd5\u3002 - Blog - Silicon Cloud","description":"Ubuntu 22.04\u306b\u304a\u3044\u3066uWSGI\u3068Nginx\u3092\u4f7f\u7528\u3057\u3066Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04\u306b\u304a\u3044\u3066\u3001uwsgi\u3068nginx\u3092\u4f7f\u7528\u3057\u3066flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\/","og_locale":"ja_JP","og_type":"article","og_title":"Ubuntu 22.04\u306b\u304a\u3044\u3066\u3001uWSGI\u3068Nginx\u3092\u4f7f\u7528\u3057\u3066Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u65b9\u6cd5\u3002","og_description":"Ubuntu 22.04\u306b\u304a\u3044\u3066uWSGI\u3068Nginx\u3092\u4f7f\u7528\u3057\u3066Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","og_url":"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04\u306b\u304a\u3044\u3066\u3001uwsgi\u3068nginx\u3092\u4f7f\u7528\u3057\u3066flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-05-21T10:03:22+00:00","article_modified_time":"2025-07-31T12:47:06+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656474d2daa94e2bdf7b75c0\/51-0.png"}],"author":"\u82bd\u4f9d, \u96e8\u591c","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u82bd\u4f9d, \u96e8\u591c","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"37\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%ab%e3%81%8a%e3%81%84%e3%81%a6%e3%80%81uwsgi%e3%81%a8nginx%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6flask%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%ab%e3%81%8a%e3%81%84%e3%81%a6%e3%80%81uwsgi%e3%81%a8nginx%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6flask%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3\/","name":"Ubuntu 22.04\u306b\u304a\u3044\u3066\u3001uWSGI\u3068Nginx\u3092\u4f7f\u7528\u3057\u3066Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u65b9\u6cd5\u3002 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2023-05-21T10:03:22+00:00","dateModified":"2025-07-31T12:47:06+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/aeb60a7861f2f002b54c66bd65bc6c27"},"description":"Ubuntu 22.04\u306b\u304a\u3044\u3066uWSGI\u3068Nginx\u3092\u4f7f\u7528\u3057\u3066Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%ab%e3%81%8a%e3%81%84%e3%81%a6%e3%80%81uwsgi%e3%81%a8nginx%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6flask%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%ab%e3%81%8a%e3%81%84%e3%81%a6%e3%80%81uwsgi%e3%81%a8nginx%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6flask%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%ab%e3%81%8a%e3%81%84%e3%81%a6%e3%80%81uwsgi%e3%81%a8nginx%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6flask%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"Ubuntu 22.04\u306b\u304a\u3044\u3066\u3001uWSGI\u3068Nginx\u3092\u4f7f\u7528\u3057\u3066Flask\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u65b9\u6cd5\u3002"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website","url":"https:\/\/www.silicloud.com\/ja\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/aeb60a7861f2f002b54c66bd65bc6c27","name":"\u82bd\u4f9d, \u96e8\u591c","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6305fe5cabc2b854c1208975a47fbf3f8cef3f7cd775b94dceedbe59b74a8010?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6305fe5cabc2b854c1208975a47fbf3f8cef3f7cd775b94dceedbe59b74a8010?s=96&d=mm&r=g","caption":"\u82bd\u4f9d, \u96e8\u591c"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/meiamaya\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%ab%e3%81%8a%e3%81%84%e3%81%a6%e3%80%81uwsgi%e3%81%a8nginx%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6flask%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/223","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=223"}],"version-history":[{"count":1,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/223\/revisions"}],"predecessor-version":[{"id":37900,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/223\/revisions\/37900"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=223"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=223"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}