{"id":227,"date":"2023-02-25T05:50:45","date_gmt":"2023-11-30T13:21:04","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%87%e3%83%93%e3%82%a2%e3%83%b311%e3%81%a7django%e3%82%92postgres%e3%80%81nginx%e3%80%81gunicorn%e3%81%a8%e5%85%b1%e3%81%ab%e3%82%bb%e3%83%83%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%e3%81%99%e3%82%8b\/"},"modified":"2024-03-19T23:15:29","modified_gmt":"2024-03-19T14:15:29","slug":"%e3%83%87%e3%83%93%e3%82%a2%e3%83%b311%e3%81%a7django%e3%82%92postgres%e3%80%81nginx%e3%80%81gunicorn%e3%81%a8%e5%85%b1%e3%81%ab%e3%82%bb%e3%83%83%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%87%e3%83%93%e3%82%a2%e3%83%b311%e3%81%a7django%e3%82%92postgres%e3%80%81nginx%e3%80%81gunicorn%e3%81%a8%e5%85%b1%e3%81%ab%e3%82%bb%e3%83%83%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%e3%81%99%e3%82%8b\/","title":{"rendered":"\u30c7\u30d3\u30a2\u30f311\u3067Django\u3092Postgres\u3001Nginx\u3001Gunicorn\u3068\u5171\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<h3>\u306f\u3058\u3081\u306b<\/h3>\n<p>Django\u306f\u3001Python\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3084\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u3092\u7acb\u3061\u4e0a\u3052\u308b\u306e\u306b\u5f79\u7acb\u3064\u5f37\u529b\u306a\u30a6\u30a7\u30d6\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002Django\u306b\u306f\u3001\u30b3\u30fc\u30c9\u3092\u30ed\u30fc\u30ab\u30eb\u3067\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306e\u958b\u767a\u30b5\u30fc\u30d0\u30fc\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u672c\u756a\u306b\u95a2\u9023\u3059\u308b\u3082\u306e\u306f\u3001\u3088\u308a\u5b89\u5168\u3067\u30d1\u30ef\u30d5\u30eb\u306a\u30a6\u30a7\u30d6\u30b5\u30fc\u30d0\u30fc\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u30ac\u30a4\u30c9\u3067\u306f\u3001Debian 11\u3067\u3044\u304f\u3064\u304b\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u8a2d\u5b9a\u3057\u3001Django\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30b5\u30dd\u30fc\u30c8\u30fb\u516c\u958b\u3057\u307e\u3059\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306eSQLite\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u4ee3\u308f\u308a\u306b\u3001PostgreSQL\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u307e\u305f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u3084\u308a\u53d6\u308a\u3059\u308b\u305f\u3081\u306bGunicorn\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u305d\u3057\u3066\u3001\u30a2\u30af\u30bb\u30b9\u53ef\u80fd\u306a\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u6a5f\u80fd\u3068\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6a5f\u80fd\u3092\u6301\u3064Nginx\u3092\u8a2d\u5b9a\u3057\u3001Gunicorn\u3078\u306e\u9006\u30d7\u30ed\u30ad\u30b7\u3092\u884c\u3044\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u6a5f\u80fd\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n<h2>\u524d\u63d0\u6761\u4ef6\u3068\u76ee\u6a19<\/h2>\n<p>\u3053\u306e\u30ac\u30a4\u30c9\u3092\u5b8c\u4e86\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u57fa\u672c\u7684\u306a\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u3068sudo\u6a29\u9650\u304c\u8a2d\u5b9a\u3055\u308c\u305fnon-root\u30e6\u30fc\u30b6\u30fc\u3092\u6301\u3063\u305f\u65b0\u9bae\u306aDebian 11\u30b5\u30fc\u30d0\u30fc\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u5fc5\u8981\u3067\u3059\u3002\u521d\u671f\u30b5\u30fc\u30d0\u30fc\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u30ac\u30a4\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067\u3001\u3053\u308c\u3092\u8a2d\u5b9a\u3059\u308b\u65b9\u6cd5\u3092\u5b66\u3076\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4eee\u60f3\u74b0\u5883\u5185\u306bDjango\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u56fa\u6709\u306e\u74b0\u5883\u306bDjango\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u3067\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3068\u305d\u306e\u8981\u4ef6\u3092\u5225\u3005\u306b\u7ba1\u7406\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3068\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u7a3c\u50cd\u3057\u3066\u3044\u308b\u72b6\u614b\u306b\u306a\u3063\u305f\u3089\u3001Gunicorn\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306eHTTP\u30ea\u30af\u30a8\u30b9\u30c8\u3092Python\u306e\u547c\u3073\u51fa\u3057\u306b\u5909\u63db\u3057\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u51e6\u7406\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3068\u3057\u3066\u6a5f\u80fd\u3057\u307e\u3059\u3002\u305d\u306e\u5f8c\u3001\u9ad8\u6027\u80fd\u306a\u63a5\u7d9a\u51e6\u7406\u30e1\u30ab\u30cb\u30ba\u30e0\u3068\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u6a5f\u80fd\u3092\u6d3b\u7528\u3059\u308b\u305f\u3081\u306b\u3001Gunicorn\u306e\u524d\u306bNginx\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\u59cb\u3081\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>Debian\u30ea\u30dd\u30b8\u30c8\u30ea\u304b\u3089\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h2>\n<p>\u30d7\u30ed\u30bb\u30b9\u3092\u958b\u59cb\u3059\u308b\u306b\u306f\u3001Debian\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u304b\u3089\u5fc5\u8981\u306a\u3059\u3079\u3066\u306e\u30a2\u30a4\u30c6\u30e0\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002\u5f8c\u3067Python\u30d1\u30c3\u30b1\u30fc\u30b8\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3067\u3042\u308bpip\u3092\u4f7f\u7528\u3057\u3066\u8ffd\u52a0\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<p>\u6700\u521d\u306b\u3001\u30ed\u30fc\u30ab\u30eb\u306aapt\u30d1\u30c3\u30b1\u30fc\u30b8\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u66f4\u65b0\u3057\u3066\u304b\u3089\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\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=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> update<\/li>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> <span class=\"token function\">install<\/span> python3-venv python3-dev libpq-dev postgresql postgresql-contrib nginx <span class=\"token function\">curl<\/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>\u3053\u306e\u30b3\u30de\u30f3\u30c9\u306f\u3001Python\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u4eee\u60f3\u74b0\u5883\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306e\u30c4\u30fc\u30eb\u3001\u5f8c\u3067Gunicorn\u3092\u30d3\u30eb\u30c9\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306aPython\u958b\u767a\u30d5\u30a1\u30a4\u30eb\u3001Postgres\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b7\u30b9\u30c6\u30e0\u3068\u305d\u308c\u3068\u306e\u76f8\u4e92\u4f5c\u7528\u306b\u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3001\u304a\u3088\u3073Nginx\u30a6\u30a7\u30d6\u30b5\u30fc\u30d0\u30fc\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<h2>PostgreSQL\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3068\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3059\u308b\u3002<\/h2>\n<p>\u4eca\u3067\u306f\u3001\u76f4\u63a5\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3068\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3057\u3066\u3001Django\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u59cb\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u3001Postgres\u306f\u30ed\u30fc\u30ab\u30eb\u63a5\u7d9a\u306b\u5bfe\u3057\u3066\u300c\u30d4\u30a2\u8a8d\u8a3c\u300d\u3068\u547c\u3070\u308c\u308b\u8a8d\u8a3c\u65b9\u5f0f\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u8981\u3059\u308b\u306b\u3001\u30e6\u30fc\u30b6\u30fc\u306e\u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0\u30b7\u30b9\u30c6\u30e0\u306e\u30e6\u30fc\u30b6\u30fc\u540d\u304c\u6709\u52b9\u306aPostgres\u306e\u30e6\u30fc\u30b6\u30fc\u540d\u3068\u4e00\u81f4\u3059\u308b\u5834\u5408\u3001\u305d\u306e\u30e6\u30fc\u30b6\u30fc\u306f\u8ffd\u52a0\u306e\u8a8d\u8a3c\u306a\u3057\u3067\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>Postgres\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u4e2d\u306b\u3001postgres\u3068\u3044\u3046\u540d\u524d\u306e\u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0\u30b7\u30b9\u30c6\u30e0\u306e\u30e6\u30fc\u30b6\u30fc\u304c\u4f5c\u6210\u3055\u308c\u307e\u3057\u305f\u3002\u3053\u308c\u306fpostgres\u306ePostgreSQL\u7ba1\u7406\u30e6\u30fc\u30b6\u30fc\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002\u7ba1\u7406\u30bf\u30b9\u30af\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u3053\u306e\u30e6\u30fc\u30b6\u30fc\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002sudo\u3092\u4f7f\u7528\u3057\u3001-u\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u30e6\u30fc\u30b6\u30fc\u540d\u3092\u6e21\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u300c\u30bf\u30a4\u30d7\u3057\u3066\u3001\u30a4\u30f3\u30bf\u30e9\u30af\u30c6\u30a3\u30d6\u306aPostgres\u30bb\u30c3\u30b7\u30e7\u30f3\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u300d<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token parameter variable\">-u<\/span> postgres psql<\/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>\u79c1\u305f\u3061\u306e\u8981\u4ef6\u3092\u8a2d\u5b9a\u3067\u304d\u308b\u3088\u3046\u306b\u3001PostgreSQL\u306e\u30d7\u30ed\u30f3\u30d7\u30c8\u304c\u63d0\u4f9b\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u6700\u521d\u306b\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u7528\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\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=\"postgres=#\">CREATE DATABASE <mark>myproject<\/mark><span class=\"token punctuation\">;<\/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<div class=\"post-conf-note\">\n<p class=\"post-conf-desc\">Note<\/p>\n<div>\u6ce8\u610f\uff1a\u3059\u3079\u3066\u306ePostgres\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306f\u30bb\u30df\u30b3\u30ed\u30f3\u3067\u7d42\u308f\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u3082\u3057\u554f\u984c\u304c\u8d77\u304d\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u30b3\u30de\u30f3\u30c9\u304c\u30bb\u30df\u30b3\u30ed\u30f3\u3067\u7d42\u308f\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/div>\n<\/div>\n<p>\u6b21\u306b\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u7528\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u5b89\u5168\u306a\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"postgres=#\">CREATE <span class=\"token environment constant\">USER<\/span> <mark>myprojectuser<\/mark> WITH PASSWORD <span class=\"token string\">&#8216;<mark>password<\/mark>&#8216;<\/span><span class=\"token punctuation\">;<\/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>\u305d\u306e\u5f8c\u3001\u4f5c\u6210\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u306e\u3044\u304f\u3064\u304b\u306e\u63a5\u7d9a\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u5909\u66f4\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u51e6\u7406\u304c\u9ad8\u901f\u5316\u3055\u308c\u3001\u63a5\u7d9a\u304c\u78ba\u7acb\u3055\u308c\u308b\u5ea6\u306b\u6b63\u3057\u3044\u5024\u3092\u554f\u3044\u5408\u308f\u305b\u3066\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>Django\u304c\u671f\u5f85\u3059\u308b\u3088\u3046\u306b\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u6587\u5b57\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092UTF-8\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u307e\u305f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u5206\u96e2\u65b9\u5f0f\u3092\u300c\u8aad\u307f\u53d6\u308a\u30b3\u30df\u30c3\u30c8\u300d\u306b\u8a2d\u5b9a\u3057\u3001\u672a\u78ba\u5b9a\u306e\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u304b\u3089\u306e\u8aad\u307f\u53d6\u308a\u3092\u30d6\u30ed\u30c3\u30af\u3057\u307e\u3059\u3002\u6700\u5f8c\u306b\u3001\u30bf\u30a4\u30e0\u30be\u30fc\u30f3\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u3001Django\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306fUTC\u3092\u4f7f\u7528\u3059\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3055\u308c\u307e\u3059\u3002\u3053\u308c\u3089\u306f\u5168\u3066Django\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u81ea\u4f53\u304b\u3089\u306e\u63a8\u5968\u4e8b\u9805\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"postgres=#\">ALTER ROLE <mark>myprojectuser<\/mark> SET client_encoding TO <span class=\"token string\">&#8216;utf8&#8217;<\/span><span class=\"token punctuation\">;<\/span><\/li>\n<li data-prefix=\"postgres=#\">ALTER ROLE <mark>myprojectuser<\/mark> SET default_transaction_isolation TO <span class=\"token string\">&#8216;read committed&#8217;<\/span><span class=\"token punctuation\">;<\/span><\/li>\n<li data-prefix=\"postgres=#\">ALTER ROLE <mark>myprojectuser<\/mark> SET timezone TO <span class=\"token string\">&#8216;UTC&#8217;<\/span><span class=\"token punctuation\">;<\/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\u3001\u65b0\u3057\u3044\u30e6\u30fc\u30b6\u30fc\u306b\u65b0\u3057\u3044\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u7ba1\u7406\u6a29\u9650\u3092\u4ed8\u4e0e\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=\"postgres=#\">GRANT ALL PRIVILEGES ON DATABASE <mark>myproject<\/mark> TO <mark>myprojectuser<\/mark><span class=\"token punctuation\">;<\/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>\u4f5c\u696d\u304c\u7d42\u308f\u3063\u305f\u3089\u3001PostgreSQL\u306e\u30d7\u30ed\u30f3\u30d7\u30c8\u304b\u3089\u9000\u51fa\u3059\u308b\u305f\u3081\u306b\u3001\u5165\u529b\u3059\u308b\u3053\u3068\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"postgres=#\"><span class=\"token punctuation\">\\<\/span>q<\/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>\ud83c\uddef\ud83c\uddf5 PostgreSQL\u306f\u73fe\u5728\u3001Django\u304c\u63a5\u7d9a\u3057\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u60c5\u5831\u3092\u7ba1\u7406\u3067\u304d\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u305f\u3081\u306ePython\u4eee\u60f3\u74b0\u5883\u3092\u4f5c\u6210\u3059\u308b<\/h2>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u6e96\u5099\u3067\u304d\u305f\u306e\u3067\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u6b8b\u308a\u306e\u8981\u4ef6\u3092\u53d6\u5f97\u3057\u59cb\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4eee\u60f3\u74b0\u5883\u5185\u3067Python\u306e\u8981\u4ef6\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<p>\u6700\u521d\u306b\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3067\u304d\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3001\u305d\u3053\u306b\u79fb\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\">mkdir<\/span> ~\/<mark>myprojectdir<\/mark><\/li>\n<li data-prefix=\"$\"><span class=\"token builtin class-name\">cd<\/span> ~\/<mark>myprojectdir<\/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>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u3067\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u3066Python\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 <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>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u65e5\u672c\u8a9e\u3067\u8868\u73fe\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\uff1a\u300c\u3053\u308c\u306b\u3088\u308a\u3001myprojectdir \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306b myprojectenv \u3068\u3044\u3046\u540d\u524d\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002\u5185\u90e8\u306b\u306f\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u7ba1\u7406\u306b\u4f7f\u7528\u3059\u308b\u30ed\u30fc\u30ab\u30eb\u30d0\u30fc\u30b8\u30e7\u30f3\u306ePython\u3068pip\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3059\u3002\u3053\u306e\u4eee\u60f3\u74b0\u5883\u306e\u69cb\u9020\u3092\u4f7f\u7528\u3057\u3066\u3001\u4f5c\u6210\u3057\u305f\u3044\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u305f\u3081\u306b\u5206\u96e2\u3055\u308c\u305fPython\u74b0\u5883\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304a\u3088\u3073\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u300d<\/p>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306ePython\u306e\u8981\u4ef6\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u524d\u306b\u3001\u4eee\u60f3\u74b0\u5883\u3092\u30a2\u30af\u30c6\u30a3\u30d9\u30fc\u30c8\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5165\u529b\u3059\u308b\u3053\u3068\u3067\u30a2\u30af\u30c6\u30a3\u30d9\u30fc\u30c8\u3067\u304d\u307e\u3059\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>\u4ee5\u4e0b\u306e\u65e5\u672c\u8a9e\u8a33\u306e\u5019\u88dc\u3092\uff11\u3064\u63d0\u4f9b\u3057\u307e\u3059\u3002<\/p>\n<p>\u30d7\u30ed\u30f3\u30d7\u30c8\u306f\u3001Python\u306e\u4eee\u60f3\u74b0\u5883\u5185\u3067\u64cd\u4f5c\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u793a\u3059\u3088\u3046\u306b\u5909\u66f4\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u6b21\u306e\u3088\u3046\u306b\u8868\u793a\u3055\u308c\u307e\u3059\uff1a\uff08myprojectenv\uff09user@host:~\/myprojectdir$\u3002<\/p>\n<p>\u4eee\u60f3\u74b0\u5883\u3092\u30a2\u30af\u30c6\u30a3\u30d6\u306b\u3057\u305f\u72b6\u614b\u3067\u3001pip\u3092\u4f7f\u7528\u3057\u3066Django\u3001Gunicorn\u3001\u305d\u3057\u3066psycopg2 PostgreSQL\u30a2\u30c0\u30d7\u30bf\u30fc\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div class=\"post-conf-note\">\n<p class=\"post-conf-desc\">Note<\/p>\n<div>\u6ce8\u610f\uff1a\u4eee\u60f3\u74b0\u5883\u304c\u30a2\u30af\u30c6\u30a3\u30d6\u306b\u306a\u3063\u3066\u3044\u308b\u5834\u5408\uff08\u30d7\u30ed\u30f3\u30d7\u30c8\u306e\u524d\u306b\uff08myprojectenv\uff09\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u5834\u5408\uff09\u3001Python 3\u3092\u4f7f\u7528\u3057\u3066\u3044\u3066\u3082pip\u3067\u306f\u306a\u304fpip3\u3092\u4f7f\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u4eee\u60f3\u74b0\u5883\u306e\u30b3\u30d4\u30fc\u306f\u5e38\u306bpip\u3068\u3044\u3046\u540d\u524d\u3067\u3059\u304c\u3001Python\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u95a2\u4fc2\u306a\u304f\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<\/div>\n<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"(myprojectenv) $\">pip <span class=\"token function\">install<\/span> django gunicorn psycopg2-binary<\/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\u306f\u3001Django\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u59cb\u3081\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3092\u3059\u3079\u3066\u63c3\u3048\u308b\u3079\u304d\u3067\u3059\u3002<\/p>\n<h2>\u65b0\u3057\u3044Django\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210\u3068\u8a2d\u5b9a<\/h2>\n<p>Python\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u3001\u5b9f\u969b\u306eDjango\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>Django\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3059\u308b<\/h3>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u65e2\u306b\u5b58\u5728\u3059\u308b\u306e\u3067\u3001Django\u306b\u3053\u3053\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3088\u3046\u306b\u6307\u793a\u3057\u307e\u3059\u3002\u5b9f\u969b\u306e\u30b3\u30fc\u30c9\u3092\u542b\u30802\u756a\u76ee\u306e\u30ec\u30d9\u30eb\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u4f5c\u6210\u3055\u308c\u3001\u3053\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u7ba1\u7406\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u914d\u7f6e\u3055\u308c\u307e\u3059\u3002\u91cd\u8981\u306a\u70b9\u306f\u3001\u73fe\u5728\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u5bfe\u3057\u3066Django\u304c\u76f8\u5bfe\u7684\u306a\u6c7a\u5b9a\u3092\u3059\u308b\u306e\u3067\u306f\u306a\u304f\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u660e\u793a\u7684\u306b\u5b9a\u7fa9\u3057\u3066\u3044\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"(myprojectenv) $\">django-admin startproject <mark>myproject<\/mark> ~\/<mark>myprojectdir<\/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\u306e\u6642\u70b9\u3067\u3001\u3042\u306a\u305f\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\uff08\u3053\u306e\u4f8b\u3067\u306f~\/myprojectdir\uff09\u306b\u306f\u6b21\u306e\u5185\u5bb9\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u306f\u305a\u3067\u3059\u3002<\/p>\n<ul class=\"post-ul\">\n<li>~\/myprojectdir\/manage.py: A Django project management script.<\/li>\n<li>~\/myprojectdir\/myproject\/: The Django project package. This should contain the __init__.py, settings.py, urls.py, asgi.py, and wsgi.py files.<\/li>\n<li>~\/myprojectdir\/myprojectenv\/: The virtual environment directory you created earlier.<\/li>\n<\/ul>\n<h3>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u8a2d\u5b9a\u3092\u8abf\u6574\u3059\u308b\u3002 (Purojekuto no settei o ch\u014dsa suru)<\/h3>\n<p>\u65b0\u305f\u306b\u4f5c\u6210\u3057\u305f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u6271\u3046\u969b\u306b\u6700\u521d\u306b\u884c\u3046\u3079\u304d\u3053\u3068\u306f\u3001\u8a2d\u5b9a\u306e\u8abf\u6574\u3067\u3059\u3002nano\u3084\u304a\u597d\u307f\u306e\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf\u3092\u4f7f\u7528\u3057\u3066\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\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>myprojectdir<\/mark>\/<mark>myproject<\/mark>\/settings.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>ALLOWED_HOSTS\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3092\u63a2\u3057\u59cb\u3081\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30b5\u30fc\u30d0\u30fc\u306e\u30a2\u30c9\u30ec\u30b9\u307e\u305f\u306f\u30c9\u30e1\u30a4\u30f3\u540d\u306e\u30ea\u30b9\u30c8\u3092\u5b9a\u7fa9\u3057\u3001Django\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u63a5\u7d9a\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u30ea\u30b9\u30c8\u306b\u542b\u307e\u308c\u3066\u3044\u306a\u3044Host\u30d8\u30c3\u30c0\u30fc\u3092\u6301\u3064\u7740\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u306f\u4f8b\u5916\u3092\u767a\u751f\u3055\u305b\u307e\u3059\u3002Django\u306f\u3001\u3053\u306e\u8a2d\u5b9a\u3092\u884c\u3046\u3053\u3068\u3067\u3001\u7279\u5b9a\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u4e0a\u306e\u8106\u5f31\u6027\u3092\u9632\u6b62\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b9\u30af\u30a8\u30a2\u30d6\u30e9\u30b1\u30c3\u30c8\u5185\u306b\u306f\u3001Django\u30b5\u30fc\u30d0\u30fc\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u3066\u3044\u308bIP\u30a2\u30c9\u30ec\u30b9\u307e\u305f\u306f\u30c9\u30e1\u30a4\u30f3\u540d\u3092\u30ea\u30b9\u30c8\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u5404\u9805\u76ee\u306f\u3001\u5f15\u7528\u7b26\u3067\u56f2\u3093\u3067\u3001\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u30ab\u30f3\u30de\u3067\u533a\u5207\u3063\u3066\u304f\u3060\u3055\u3044\u3002\u30c9\u30e1\u30a4\u30f3\u5168\u4f53\u3068\u305d\u306e\u30b5\u30d6\u30c9\u30e1\u30a4\u30f3\u3078\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u5e0c\u671b\u3059\u308b\u5834\u5408\u306f\u3001\u30a8\u30f3\u30c8\u30ea\u30fc\u306e\u5148\u982d\u306b\u30d4\u30ea\u30aa\u30c9\u3092\u4ed8\u3051\u3066\u304f\u3060\u3055\u3044\u3002\u4ee5\u4e0b\u306e\u30b9\u30cb\u30da\u30c3\u30c8\u3067\u306f\u3001\u30c7\u30e2\u30f3\u30b9\u30c8\u30ec\u30fc\u30b7\u30e7\u30f3\u3068\u3057\u3066\u3044\u304f\u3064\u304b\u306e\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3055\u308c\u305f\u4f8b\u304c\u4f7f\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<div class=\"post-conf-note\">\n<p class=\"post-conf-desc\">Note<\/p>\n<div>\u6ce8\uff1a\u30d7\u30ed\u30ad\u30b7\u63a5\u7d9a\u3092\u3059\u308b\u969b\u306b\u306f\u3001\u30ed\u30fc\u30ab\u30eb\u306e Nginx \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u7d4c\u7531\u3057\u3066\u30ed\u30fc\u30ab\u30eb\u30db\u30b9\u30c8\u3092\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u4e00\u3064\u3068\u3057\u3066\u542b\u3081\u3066\u304f\u3060\u3055\u3044\u3002<\/div>\n<\/div>\n<div>\u79c1\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306emyproject\/settings.py<\/div>\n<pre class=\"post-pre\"><code>. . .\r\nALLOWED_HOSTS = ['<mark>your_server_domain_or_IP<\/mark>', '<mark>second_domain_or_IP<\/mark>', <mark>. . .<\/mark>, 'localhost']\r\n<\/code><\/pre>\n<p>\u6b21\u306b\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30a2\u30af\u30bb\u30b9\u306e\u8a2d\u5b9a\u3092\u884c\u3046\u30bb\u30af\u30b7\u30e7\u30f3\u3092\u63a2\u3057\u3066\u304f\u3060\u3055\u3044\u3002DATABASES\u304b\u3089\u59cb\u307e\u308a\u307e\u3059\u3002\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u8a2d\u5b9a\u306fSQLite\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u7528\u3067\u3059\u304c\u3001\u79c1\u305f\u3061\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u306f\u65e2\u306bPostgreSQL\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u6e08\u307f\u306a\u306e\u3067\u3001\u8a2d\u5b9a\u3092\u8abf\u6574\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u30dd\u30b9\u30c8\u30b0\u30ec\u30b9\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u60c5\u5831\u3092\u4f7f\u7528\u3057\u3066\u3001\u8a2d\u5b9a\u3092\u5909\u66f4\u3057\u307e\u3059\u3002pip\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305fpsycopg2\u30a2\u30c0\u30d7\u30bf\u30fc\u3092\u4f7f\u7528\u3059\u308b\u3088\u3046\u306bDjango\u306b\u6307\u793a\u3057\u307e\u3059\u3002\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30e6\u30fc\u30b6\u30fc\u540d\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30e6\u30fc\u30b6\u30fc\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3057\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u30ed\u30fc\u30ab\u30eb\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u4e0a\u306b\u3042\u308b\u3053\u3068\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002PORT\u8a2d\u5b9a\u3092\u7a7a\u306e\u6587\u5b57\u5217\u306e\u307e\u307e\u3067\u304a\u3044\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\u79c1\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306emyproject\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306esettings.py\u30d5\u30a1\u30a4\u30eb<\/div>\n<pre class=\"post-pre\"><code>. . .\r\n\r\nDATABASES = {\r\n    'default': {\r\n        'ENGINE': 'django.db.backends.<mark>postgresql_psycopg2<\/mark>',\r\n        'NAME': '<mark>myproject<\/mark>',\r\n        'USER': '<mark>myprojectuser<\/mark>',\r\n        'PASSWORD': '<mark>password<\/mark>',\r\n        'HOST': 'localhost',\r\n        'PORT': '',\r\n    }\r\n}\r\n\r\n. . .\r\n<\/code><\/pre>\n<p>\u6b21\u306b\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u6700\u5f8c\u306b\u79fb\u52d5\u3057\u3066\u3001\u9759\u7684\u30d5\u30a1\u30a4\u30eb\u306e\u914d\u7f6e\u5148\u3092\u793a\u3059\u8a2d\u5b9a\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u3001Nginx\u304c\u3053\u308c\u3089\u306e\u30a2\u30a4\u30c6\u30e0\u306b\u5bfe\u3059\u308b\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u51e6\u7406\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u3067\u3059\u3002\u4ee5\u4e0b\u306e\u884c\u306f\u3001Django\u306b\u305d\u308c\u3089\u3092\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u57fa\u672c\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u3042\u308bstatic\u3068\u3044\u3046\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u914d\u7f6e\u3059\u308b\u3088\u3046\u6307\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<div>~\/myprojectdir\/myproject\/settings.py\u3092\u65e5\u672c\u8a9e\u3067\u8a00\u3044\u63db\u3048\u308b\u3068\u3001<br \/>\n\u300c~\/myprojectdir\/myproject\/settings.py\u300d<\/div>\n<pre class=\"post-pre\"><code>. . .\r\nSTATIC_URL = 'static\/'\r\n\r\n# Default primary key field type\r\n# https:\/\/docs.djangoproject.com\/en\/4.0\/ref\/settings\/#default-auto-field\r\n\r\nDEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'\r\n\r\n<mark>import os<\/mark>\r\n<mark>STATIC_ROOT = os.path.join(BASE_DIR, 'static\/')<\/mark>\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\u3082\u3057nano\u3092\u4f7f\u3063\u3066\u3044\u308b\u5834\u5408\u306f\u3001Ctrl+X\u3092\u62bc\u3057\u3001\u305d\u306e\u5f8c\u306bY\u3068Enter\u3092\u62bc\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>\u6700\u521d\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3092\u5b8c\u4e86\u3059\u308b\u3002<\/h3>\n<p>\u4eca\u3001\u7ba1\u7406\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f7f\u7528\u3057\u3066\u3001\u521d\u671f\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b9\u30ad\u30fc\u30de\u3092\u79c1\u305f\u3061\u306ePostgreSQL\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u79fb\u884c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"(myprojectenv) $\">~\/<mark>myprojectdir<\/mark>\/manage.py makemigrations<\/li>\n<li data-prefix=\"(myprojectenv) $\">~\/<mark>myprojectdir<\/mark>\/manage.py migrate<\/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>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u7ba1\u7406\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3059\u308b\u306b\u306f\u3001\u30bf\u30a4\u30d7\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"(myprojectenv) $\">~\/<mark>myprojectdir<\/mark>\/manage.py createsuperuser<\/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>\u30e6\u30fc\u30b6\u30fc\u30cd\u30fc\u30e0\u3092\u9078\u629e\u3057\u3001\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u5165\u529b\u3057\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u9078\u629e\u3057\u78ba\u8a8d\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 (Y\u016bz\u0101n\u0113mu o sentaku shi, m\u0113ru adoresu o ny\u016bryoku shi, pasuw\u0101do o sentaku shi kakunin suru hitsuy\u014d ga arimasu.)<\/p>\n<p>\u6307\u5b9a\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u5834\u6240\u306b\u3001\u9759\u7684\u306a\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u3059\u3079\u3066\u53ce\u96c6\u3059\u308b\u306b\u306f\u3001\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=\"(myprojectenv) $\">~\/<mark>myprojectdir<\/mark>\/manage.py collectstatic<\/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>\u64cd\u4f5c\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u305d\u306e\u5f8c\u3001\u9759\u7684\u30d5\u30a1\u30a4\u30eb\u306f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306e\u300cstatic\u300d\u3068\u3044\u3046\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u914d\u7f6e\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u3082\u3057\u6700\u521d\u306e\u30b5\u30fc\u30d0\u30fc\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u30ac\u30a4\u30c9\u306b\u5f93\u3063\u305f\u306a\u3089\u3070\u3001\u30b5\u30fc\u30d0\u30fc\u306fUFW\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u3067\u5b88\u3089\u308c\u3066\u3044\u308b\u306f\u305a\u3067\u3059\u3002\u958b\u767a\u30b5\u30fc\u30d0\u30fc\u3092\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306b\u3001\u4f7f\u7528\u3059\u308b\u30dd\u30fc\u30c8\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u8a31\u53ef\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u30dd\u30fc\u30c88000\u306b\u5bfe\u3057\u3066\u4f8b\u5916\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306b\u3001\u4ee5\u4e0b\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=\"(myprojectenv) $\"><span class=\"token function\">sudo<\/span> ufw allow <span class=\"token number\">8000<\/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>\u6700\u7d42\u7684\u306b\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3067Django\u958b\u767a\u30b5\u30fc\u30d0\u30fc\u3092\u8d77\u52d5\u3057\u3066\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\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=\"(myprojectenv) $\">~\/<mark>myprojectdir<\/mark>\/manage.py runserver <span class=\"token number\">0.0<\/span>.0.0:8000<\/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>\u30a6\u30a7\u30d6\u30d6\u30e9\u30a6\u30b6\u3067\u3001\u30b5\u30fc\u30d0\u306e\u30c9\u30e1\u30a4\u30f3\u540d\u307e\u305f\u306fIP\u30a2\u30c9\u30ec\u30b9\u306e\u5f8c\u306b &#8220;:8000&#8221; \u3092\u4ed8\u3051\u3066\u30a2\u30af\u30bb\u30b9\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code>http:\/\/<mark>server_domain_or_IP<\/mark>:8000\r\n<\/code><\/pre>\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u306eDjango\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30da\u30fc\u30b8\u3092\u53d7\u3051\u53d6\u308b\u3079\u304d\u3067\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656477dbdaa94e2bdf7b826c\/87-0.png\" alt=\"Django index page\" \/><\/div>\n<p>\u30a2\u30c9\u30ec\u30b9\u30d0\u30fc\u306eURL\u306e\u672b\u5c3e\u306b\/admin\u3092\u8ffd\u52a0\u3059\u308b\u3068\u3001createsuperuser\u30b3\u30de\u30f3\u30c9\u3067\u4f5c\u6210\u3057\u305f\u7ba1\u7406\u8005\u306e\u30e6\u30fc\u30b6\u30fc\u540d\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3059\u308b\u3088\u3046\u6c42\u3081\u3089\u308c\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656477dbdaa94e2bdf7b826c\/89-0.png\" alt=\"Django admin login\" \/><\/div>\n<p>\u8a8d\u8a3c\u5f8c\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306eDjango\u7ba1\u7406\u8005\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656477dbdaa94e2bdf7b826c\/91-0.png\" alt=\"Django admin interface\" \/><\/div>\n<p>\u63a2\u7d22\u304c\u7d42\u308f\u3063\u305f\u3089\u3001\u958b\u767a\u30b5\u30fc\u30d0\u30fc\u3092\u30b7\u30e3\u30c3\u30c8\u30c0\u30a6\u30f3\u3059\u308b\u305f\u3081\u306b\u30bf\u30fc\u30df\u30ca\u30eb\u30a6\u30a3\u30f3\u30c9\u30a6\u3067CTRL-C\u3092\u62bc\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>Gunicorn\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3078\u306e\u30b5\u30fc\u30d3\u30b9\u80fd\u529b\u3092\u30c6\u30b9\u30c8\u4e2d\u3002<\/h3>\n<p>\u4eee\u60f3\u74b0\u5883\u304b\u3089\u51fa\u308b\u524d\u306b\u884c\u3046\u6700\u5f8c\u306e\u4f5c\u696d\u306f\u3001Gunicorn\u304c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u9069\u5207\u306b\u63d0\u4f9b\u3067\u304d\u308b\u304b\u3092\u30c6\u30b9\u30c8\u3059\u308b\u3053\u3068\u3067\u3059\u3002\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3057\u3001gunicorn\u3092\u4f7f\u7528\u3057\u3066\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306eWSGI\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u8aad\u307f\u8fbc\u3080\u3053\u3068\u3067\u3001\u3053\u308c\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"(myprojectenv) $\"><span class=\"token builtin class-name\">cd<\/span> ~\/<mark>myprojectdir<\/mark><\/li>\n<li data-prefix=\"(myprojectenv) $\">gunicorn <span class=\"token parameter variable\">&#8211;bind<\/span> <span class=\"token number\">0.0<\/span>.0.0:8000 <mark>myproject<\/mark>.wsgi<\/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>Django\u306e\u958b\u767a\u30b5\u30fc\u30d0\u30fc\u304c\u5b9f\u884c\u3055\u308c\u3066\u3044\u305f\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3067\u3001\u3053\u308c\u306b\u3088\u308aGunicorn\u304c\u958b\u59cb\u3055\u308c\u307e\u3059\u3002\u30d6\u30e9\u30a6\u30b6\u3067\u30a2\u30d7\u30ea\u3092\u518d\u5ea6\u30c6\u30b9\u30c8\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<div class=\"post-conf-note\">\n<p class=\"post-conf-desc\">Note<\/p>\n<div>\u6ce8\uff1a\u7ba1\u7406\u8005\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306f\u30b9\u30bf\u30a4\u30ea\u30f3\u30b0\u304c\u9069\u7528\u3055\u308c\u306a\u3044\u305f\u3081\u3001Gunicorn\u306f\u305d\u306e\u9759\u7684\u306aCSS\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u898b\u3064\u3051\u308b\u65b9\u6cd5\u3092\u77e5\u308a\u307e\u305b\u3093\u3002<\/div>\n<\/div>\n<p>Django\u306ewsgi.py\u30d5\u30a1\u30a4\u30eb\u3078\u306e\u76f8\u5bfe\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30d1\u30b9\u3092\u6307\u5b9a\u3057\u3066\u3001Gunicorn\u306b\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u6e21\u3057\u307e\u3057\u305f\u3002\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u4e2d\u3067\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u306e\u901a\u4fe1\u306b\u4f7f\u7528\u3055\u308c\u308bapplication\u3068\u3044\u3046\u540d\u524d\u306e\u95a2\u6570\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u3059\u3002WSGI\u4ed5\u69d8\u306e\u8a73\u7d30\u306b\u3064\u3044\u3066\u306f\u3001\u3053\u3053\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u30c6\u30b9\u30c8\u304c\u7d42\u308f\u3063\u305f\u3089\u3001Gunicorn\u3092\u505c\u6b62\u3059\u308b\u305f\u3081\u306b\u30bf\u30fc\u30df\u30ca\u30eb\u30a6\u30a3\u30f3\u30c9\u30a6\u3067CTRL-C\u3092\u62bc\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>Django\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u8a2d\u5b9a\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3002\u4eee\u60f3\u74b0\u5883\u304b\u3089\u7d42\u4e86\u3059\u308b\u306b\u306f\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\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=\"(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>\u3042\u306a\u305f\u306e\u30d7\u30ed\u30f3\u30d7\u30c8\u306b\u3042\u308b\u4eee\u60f3\u74b0\u5883\u306e\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc\u306f\u524a\u9664\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2>\u300cGunicorn\u306e\u305f\u3081\u306esystemd\u306e\u30bd\u30b1\u30c3\u30c8\u3068\u30b5\u30fc\u30d3\u30b9\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u300d<\/h2>\n<p>Gunicorn\u3068Django\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u9023\u643a\u3067\u304d\u308b\u3053\u3068\u306f\u78ba\u8a8d\u3057\u307e\u3057\u305f\u304c\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u306e\u8d77\u52d5\u3068\u505c\u6b62\u3092\u3088\u308a\u5805\u7262\u306a\u65b9\u6cd5\u3067\u5b9f\u88c5\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u3092\u5b9f\u73fe\u3059\u308b\u305f\u3081\u306b\u3001systemd\u306e\u30b5\u30fc\u30d3\u30b9\u30d5\u30a1\u30a4\u30eb\u3068\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>Gunicorn\u306e\u30bd\u30b1\u30c3\u30c8\u306f\u8d77\u52d5\u6642\u306b\u4f5c\u6210\u3055\u308c\u3001\u63a5\u7d9a\u3092\u5f85\u3061\u53d7\u3051\u307e\u3059\u3002\u63a5\u7d9a\u304c\u767a\u751f\u3059\u308b\u3068\u3001systemd\u306f\u81ea\u52d5\u7684\u306bGunicorn\u30d7\u30ed\u30bb\u30b9\u3092\u8d77\u52d5\u3057\u3066\u63a5\u7d9a\u3092\u51e6\u7406\u3057\u307e\u3059\u3002<\/p>\n<p>\u6700\u521d\u306b\u3001Gunicorn\u306e\u305f\u3081\u306esystemd\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u3092sudo\u6a29\u9650\u3067\u4f5c\u6210\u3057\u3066\u958b\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> <span class=\"token function\">nano<\/span> \/etc\/systemd\/system\/gunicorn.socket<\/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>\u5185\u90e8\u306b\u306f\u3001[Unit]\u30bb\u30af\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3057\u3066\u30bd\u30b1\u30c3\u30c8\u3092\u8aac\u660e\u3057\u3001[Socket]\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u30bd\u30b1\u30c3\u30c8\u306e\u4f4d\u7f6e\u3092\u5b9a\u7fa9\u3057\u3001[Install]\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u30bd\u30b1\u30c3\u30c8\u304c\u6b63\u3057\u3044\u6642\u306b\u4f5c\u6210\u3055\u308c\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<div>\/etc\/systemd\/system\/gunicorn.socket\u3092\u65e5\u672c\u8a9e\u3067\u8a00\u3044\u63db\u3048\u308b\u3068\u3001\u300c\/etc\/systemd\/system\/gunicorn.socket\u300d\u3068\u306a\u308a\u307e\u3059\u3002<\/div>\n<pre class=\"post-pre\"><code>[Unit]\r\nDescription=gunicorn socket\r\n\r\n[Socket]\r\nListenStream=\/run\/gunicorn.sock\r\n\r\n[Install]\r\nWantedBy=sockets.target\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>\u6b21\u306b\u3001\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf\u3067sudo\u7279\u6a29\u3092\u6301\u3063\u3066Gunicorn\u306esystemd\u30b5\u30fc\u30d3\u30b9\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u958b\u304d\u307e\u3059\u3002\u30b5\u30fc\u30d3\u30b9\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u306f\u3001\u62e1\u5f35\u5b50\u3092\u9664\u3044\u3066\u30bd\u30b1\u30c3\u30c8\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u3068\u4e00\u81f4\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=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">nano<\/span> \/etc\/systemd\/system\/gunicorn.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>\u4ee5\u4e0b\u306f\u3001\u65e5\u672c\u8a9e\u3067\u306e\u4e00\u3064\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u8a00\u3044\u63db\u3048\u3067\u3059\uff1a<br \/>\n\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\u304b\u3089\u59cb\u3081\u307e\u3059\u3002\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\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u8d77\u52d5\u3059\u308b\u3088\u3046\u306binit\u30b7\u30b9\u30c6\u30e0\u306b\u6307\u793a\u3057\u307e\u3059\u3002\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u306e\u30bd\u30b1\u30c3\u30c8\u306b\u4f9d\u5b58\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u95a2\u9023\u6027\u3092\u793a\u3059\u305f\u3081\u306bRequires\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3092\u542b\u3081\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<div>\/etc\/systemd\/system\/gunicorn.service\u3092\u65e5\u672c\u8a9e\u3067\u4e00\u3064\u306e\u8868\u73fe\u306b\u8a00\u3044\u63db\u3048\u3066\u304f\u3060\u3055\u3044\u3002<\/div>\n<pre class=\"post-pre\"><code>[Unit]\r\nDescription=gunicorn daemon\r\nRequires=gunicorn.socket\r\nAfter=network.target\r\n<\/code><\/pre>\n<p>\u305d\u306e\u5f8c\u3001[Service]\u30bb\u30af\u30b7\u30e7\u30f3\u3092\u66f8\u304d\u307e\u3059\u3002\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\u306f\u3059\u3079\u3066\u6240\u6709\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u901a\u5e38\u306e\u30e6\u30fc\u30b6\u30fc\u30a2\u30ab\u30a6\u30f3\u30c8\u306b\u51e6\u7406\u306e\u6240\u6709\u6a29\u3092\u4e0e\u3048\u307e\u3059\u3002\u307e\u305f\u3001Nginx\u304cGunicorn\u3068\u901a\u4fe1\u3067\u304d\u308b\u3088\u3046\u306b\u3001\u30b0\u30eb\u30fc\u30d7\u6240\u6709\u6a29\u3092www-data\u30b0\u30eb\u30fc\u30d7\u306b\u4e0e\u3048\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306b\u3001\u4f5c\u696d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u30de\u30c3\u30d7\u3057\u3001\u30b5\u30fc\u30d3\u30b9\u3092\u958b\u59cb\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u3053\u306e\u5834\u5408\u3001\u4eee\u60f3\u74b0\u5883\u5185\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308bGunicorn\u306e\u5b9f\u884c\u30d5\u30a1\u30a4\u30eb\u306e\u5b8c\u5168\u306a\u30d1\u30b9\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u6b21\u306b\u3001\u4f5c\u6210\u3057\u305fUnix\u30bd\u30b1\u30c3\u30c8\u306b\u30d7\u30ed\u30bb\u30b9\u3092\u30d0\u30a4\u30f3\u30c9\u3057\u3066\u3001\u30d7\u30ed\u30bb\u30b9\u304cNginx\u3068\u901a\u4fe1\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002Gunicorn\u306e\u30ed\u30b0\u3092journald\u30d7\u30ed\u30bb\u30b9\u304c\u53ce\u96c6\u3067\u304d\u308b\u3088\u3046\u306b\u3001\u3059\u3079\u3066\u306e\u30c7\u30fc\u30bf\u3092\u6a19\u6e96\u51fa\u529b\u306b\u8a18\u9332\u3057\u307e\u3059\u3002\u307e\u305f\u3001\u3053\u3053\u3067\u4efb\u610f\u306eGunicorn\u306e\u8abf\u6574\u3082\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u3053\u306e\u5834\u5408\u306f3\u3064\u306e\u30ef\u30fc\u30ab\u30fc\u30d7\u30ed\u30bb\u30b9\u3092\u6307\u5b9a\u3057\u307e\u3057\u305f\u3002<\/p>\n<div>\u4ee5\u4e0b\u306e\u6587\u3092\u65e5\u672c\u8a9e\u3067\u81ea\u7136\u306a\u8868\u73fe\u306b\u8a00\u3044\u63db\u3048\u308b\u3068\uff1a<br \/>\n\u300c\/etc\/systemd\/system\/gunicorn.service\u300d<\/div>\n<pre class=\"post-pre\"><code>[Unit]\r\nDescription=gunicorn daemon\r\nRequires=gunicorn.socket\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>myprojectdir<\/mark>\r\nExecStart=\/home\/<mark>sammy<\/mark>\/<mark>myprojectdir<\/mark>\/<mark>myprojectenv<\/mark>\/bin\/gunicorn \\\r\n          --access-logfile - \\\r\n          --workers 3 \\\r\n          --bind unix:\/run\/gunicorn.sock \\\r\n          <mark>myproject<\/mark>.wsgi:application\r\n<\/code><\/pre>\n<p>\u6700\u5f8c\u306b\u3001[Install]\u30bb\u30af\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u8d77\u52d5\u6642\u306b\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u6709\u52b9\u306b\u3059\u308b\u5834\u5408\u3001systemd\u306b\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u3069\u306e\u3088\u3046\u306b\u95a2\u9023\u4ed8\u3051\u308b\u304b\u3092\u6307\u793a\u3057\u307e\u3059\u3002\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u306f\u901a\u5e38\u306e\u30de\u30eb\u30c1\u30e6\u30fc\u30b6\u30fc\u30b7\u30b9\u30c6\u30e0\u304c\u8d77\u52d5\u3057\u3066\u7a3c\u50cd\u3057\u3066\u3044\u308b\u3068\u304d\u306b\u8d77\u52d5\u3059\u308b\u3088\u3046\u306b\u3057\u305f\u3044\u3067\u3059\u3002<\/p>\n<div>\u4ee5\u4e0b\u306f\u65e5\u672c\u8a9e\u3067\u306e\u540c\u7fa9\u8868\u73fe\u3067\u3059\uff08\uff11\u3064\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u307f\uff09\uff1a<br \/>\n\u300c\/etc\/systemd\/system\/gunicorn.service\u300d<\/div>\n<pre class=\"post-pre\"><code>[Unit]\r\nDescription=gunicorn daemon\r\nRequires=gunicorn.socket\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>myprojectdir<\/mark>\r\nExecStart=\/home\/<mark>sammy<\/mark>\/<mark>myprojectdir<\/mark>\/<mark>myprojectenv<\/mark>\/bin\/gunicorn \\\r\n          --access-logfile - \\\r\n          --workers 3 \\\r\n          --bind unix:\/run\/gunicorn.sock \\\r\n          <mark>myproject<\/mark>.wsgi:application\r\n\r\n[Install]\r\nWantedBy=multi-user.target\r\n<\/code><\/pre>\n<p>\u305d\u308c\u306b\u3088\u3063\u3066\u3001\u3042\u306a\u305f\u306esystemd\u306e\u30b5\u30fc\u30d3\u30b9\u30d5\u30a1\u30a4\u30eb\u306f\u5b8c\u6210\u3057\u307e\u3059\u3002\u4fdd\u5b58\u3057\u3066\u9589\u3058\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>Gunicorn\u30bd\u30b1\u30c3\u30c8\u3092\u4eca\u3059\u3050\u958b\u59cb\u3057\u6709\u52b9\u5316\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u304c\/run\/gunicorn.sock\u306b\u4f5c\u6210\u3055\u308c\u3001\u8d77\u52d5\u6642\u306b\u3082\u540c\u69d8\u306b\u751f\u6210\u3055\u308c\u307e\u3059\u3002\u305d\u306e\u30bd\u30b1\u30c3\u30c8\u3078\u306e\u63a5\u7d9a\u304c\u884c\u308f\u308c\u308b\u3068\u3001systemd\u306f\u81ea\u52d5\u7684\u306bgunicorn.service\u3092\u8d77\u52d5\u3057\u3066\u51e6\u7406\u3057\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 gunicorn.socket<\/li>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> systemctl <span class=\"token builtin class-name\">enable<\/span> gunicorn.socket<\/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>\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u3067\u3001\u64cd\u4f5c\u304c\u6210\u529f\u3057\u305f\u3053\u3068\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>Gunicorn\u306e\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3044\u307e\u3059\u3002<\/h2>\n<p>\u30d7\u30ed\u30bb\u30b9\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3001\u958b\u59cb\u3067\u304d\u305f\u304b\u3069\u3046\u304b\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 gunicorn.socket<\/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\u3088\u3046\u306a\u51fa\u529b\u3092\u53d7\u3051\u53d6\u308b\u3079\u304d\u3067\u3059\u3002 (Kono you na shutsuryoku o uketoru beki desu.)<\/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 gunicorn.socket &#8211; gunicorn socket Loaded: loaded (\/etc\/systemd\/system\/gunicorn.socket; enabled; vendor preset: enabled) Active: active (listening) since Thu 2022-08-04 19:02:54 UTC; 5s ago Triggers: \u25cf gunicorn.service Listen: \/run\/gunicorn.sock (Stream) CGroup: \/system.slice\/gunicorn.socket Apr 18 17:53:25 django systemd[1]: Listening on gunicorn socket.<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u6b21\u306b\u3001\/run\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306bgunicorn.sock\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308b\u304b\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\">file<\/span> \/run\/gunicorn.sock<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\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>\/run\/gunicorn.sock: socket<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u65e5\u672c\u8a9e\u3067\u8a00\u3044\u63db\u3048\u307e\u3059\uff08\uff11\u3064\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u307f\uff09\uff1a<br \/>\nsystemctl status\u30b3\u30de\u30f3\u30c9\u304c\u30a8\u30e9\u30fc\u3092\u793a\u3057\u305f\u5834\u5408\u3001\u307e\u305f\u306f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306bgunicorn.sock\u30d5\u30a1\u30a4\u30eb\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u5834\u5408\u3001\u305d\u308c\u306fGunicorn\u30bd\u30b1\u30c3\u30c8\u304c\u6b63\u3057\u304f\u4f5c\u6210\u3067\u304d\u306a\u304b\u3063\u305f\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002Gunicorn\u30bd\u30b1\u30c3\u30c8\u306e\u30ed\u30b0\u3092\u78ba\u8a8d\u3059\u308b\u306b\u306f\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\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> journalctl <span class=\"token parameter variable\">-u<\/span> gunicorn.socket<\/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>\u7d9a\u884c\u3059\u308b\u524d\u306b\u3001\u554f\u984c\u304c\u306a\u3044\u304b\u3069\u3046\u304b\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u3001\/etc\/systemd\/system\/gunicorn.socket\u30d5\u30a1\u30a4\u30eb\u3092\u3082\u3046\u4e00\u5ea6\u898b\u76f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>Socket Activation\u306e\u30c6\u30b9\u30c8\u3092\u884c\u3046<\/h2>\n<p>\u73fe\u5728\u3001gunicorn.socket\u30e6\u30cb\u30c3\u30c8\u306e\u307f\u3092\u8d77\u52d5\u3057\u3066\u3044\u308b\u5834\u5408\u3001\u30bd\u30b1\u30c3\u30c8\u306b\u63a5\u7d9a\u304c\u307e\u3060\u306a\u3044\u305f\u3081\u3001gunicorn.service\u306f\u307e\u3060\u30a2\u30af\u30c6\u30a3\u30d6\u306b\u306a\u308a\u307e\u305b\u3093\u3002\u3053\u308c\u3092\u78ba\u8a8d\u3059\u308b\u306b\u306f\u3001\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 function\">sudo<\/span> systemctl status gunicorn<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\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>\u25cb gunicorn.service &#8211; gunicorn daemon Loaded: loaded (\/etc\/systemd\/system\/gunicorn.service; disabled; vendor preset: enabled) <mark>Active: inactive (dead)<\/mark> TriggeredBy: \u25cf gunicorn.socket<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u30bd\u30b1\u30c3\u30c8\u30a2\u30af\u30c6\u30a3\u30d9\u30fc\u30b7\u30e7\u30f3\u306e\u4ed5\u7d44\u307f\u3092\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306b\u3001curl\u3092\u4f7f\u3063\u3066\u30bd\u30b1\u30c3\u30c8\u3078\u306e\u63a5\u7d9a\u3092\u9001\u4fe1\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\">curl<\/span> &#8211;unix-socket \/run\/gunicorn.sock localhost<\/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>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306eHTML\u51fa\u529b\u304c\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u53d7\u3051\u53d6\u308c\u308b\u306f\u305a\u3067\u3059\u3002\u3053\u308c\u306f\u3001Gunicorn\u304c\u8d77\u52d5\u3057\u3001Django\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3067\u304d\u305f\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002Gunicorn\u30b5\u30fc\u30d3\u30b9\u304c\u5b9f\u884c\u4e2d\u3067\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u306b\u306f\u3001\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 function\">sudo<\/span> systemctl status gunicorn<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\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 gunicorn.service &#8211; gunicorn daemon Loaded: loaded (\/etc\/systemd\/system\/gunicorn.service; disabled; vendor preset: enabled) Active: active (running) since Thu 2022-08-04 19:03:51 UTC; 5s ago TriggeredBy: \u25cf gunicorn.socket Main PID: 102674 (gunicorn) Tasks: 4 (limit: 4665) Memory: 94.2M CPU: 885ms CGroup: \/system.slice\/gunicorn.service \u251c\u2500102674 \/home\/sammy\/myprojectdir\/myprojectenv\/bin\/python3 \/home\/sammy\/myprojectdir\/myprojectenv\/bin\/gunicorn &#8211;access-logfile &#8211; &#8211;workers 3 &#8211;bind unix:\/run\/gunicorn.sock myproject.wsgi:application \u251c\u2500102675 \/home\/sammy\/myprojectdir\/myprojectenv\/bin\/python3 \/home\/sammy\/myprojectdir\/myprojectenv\/bin\/gunicorn &#8211;access-logfile &#8211; &#8211;workers 3 &#8211;bind unix:\/run\/gunicorn.sock myproject.wsgi:application \u251c\u2500102676 \/home\/sammy\/myprojectdir\/myprojectenv\/bin\/python3 \/home\/sammy\/myprojectdir\/myprojectenv\/bin\/gunicorn &#8211;access-logfile &#8211; &#8211;workers 3 &#8211;bind unix:\/run\/gunicorn.sock myproject.wsgi:application \u2514\u2500102677 \/home\/sammy\/myprojectdir\/myprojectenv\/bin\/python3 \/home\/sammy\/myprojectdir\/myprojectenv\/bin\/gunicorn &#8211;access-logfile &#8211; &#8211;workers 3 &#8211;bind unix:\/run\/gunicorn.sock myproject.wsgi:application Apr 18 17:54:49 django systemd[1]: Started gunicorn daemon. Apr 18 17:54:49 django gunicorn[102674]: [2022-04-18 17:54:49 +0000] [102674] [INFO] Starting gunicorn 20.1.0 Apr 18 17:54:49 django gunicorn[102674]: [2022-04-18 17:54:49 +0000] [102674] [INFO] Listening at: unix:\/run\/gunicorn.sock (102674) Apr 18 17:54:49 django gunicorn[102674]: [2022-04-18 17:54:49 +0000] [102674] [INFO] Using worker: sync Apr 18 17:54:49 django gunicorn[102675]: [2022-04-18 17:54:49 +0000] [102675] [INFO] Booting worker with pid: 102675 Apr 18 17:54:49 django gunicorn[102676]: [2022-04-18 17:54:49 +0000] [102676] [INFO] Booting worker with pid: 102676 Apr 18 17:54:50 django gunicorn[102677]: [2022-04-18 17:54:50 +0000] [102677] [INFO] Booting worker with pid: 102677 Apr 18 17:54:50 django gunicorn[102675]: &#8211; &#8211; [18\/Apr\/2022:17:54:50 +0000] &#8220;GET \/ HTTP\/1.1&#8221; 200 10697 &#8220;-&#8221; &#8220;curl\/7.81.0&#8221;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3082\u3057curl\u306e\u51fa\u529b\u307e\u305f\u306fsystemctl status\u306e\u51fa\u529b\u306b\u554f\u984c\u304c\u767a\u751f\u3057\u305f\u3053\u3068\u304c\u793a\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u3001\u8a73\u7d30\u60c5\u5831\u306e\u305f\u3081\u306b\u30ed\u30b0\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> journalctl <span class=\"token parameter variable\">-u<\/span> gunicorn<\/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>\/etc\/systemd\/system\/gunicorn.service \u30d5\u30a1\u30a4\u30eb\u306b\u554f\u984c\u304c\u306a\u3044\u304b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002\/etc\/systemd\/system\/gunicorn.service \u30d5\u30a1\u30a4\u30eb\u306b\u5909\u66f4\u3092\u52a0\u3048\u305f\u5834\u5408\u306f\u3001\u30c7\u30fc\u30e2\u30f3\u3092\u30ea\u30ed\u30fc\u30c9\u3057\u3066\u30b5\u30fc\u30d3\u30b9\u306e\u5b9a\u7fa9\u3092\u518d\u8aad\u307f\u8fbc\u307f\u3057\u3001Gunicorn \u30d7\u30ed\u30bb\u30b9\u3092\u518d\u8d77\u52d5\u3059\u308b\u305f\u3081\u306b\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\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> systemctl daemon-reload<\/li>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> systemctl restart gunicorn<\/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>\u7d9a\u884c\u3059\u308b\u524d\u306b\u3001\u4e0a\u8a18\u306e\u554f\u984c\u70b9\u3092\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u3057\u3066\u304f\u3060\u3055\u3044\u3002 (Zok\u014d suru mae ni, j\u014dki no mondai-ten o toraburush\u016btingu shite kudasai.)<\/p>\n<h2>Nginx\u3092\u8a2d\u5b9a\u3057\u3066\u3001Gunicorn\u306bProxy Pass\u3092\u884c\u3046\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/h2>\n<p>Gunicorn\u304c\u8a2d\u5b9a\u3055\u308c\u305f\u306e\u3067\u3001Nginx\u3092\u69cb\u6210\u3057\u3066\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\u3092\u30d7\u30ed\u30bb\u30b9\u306b\u6e21\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>Nginx\u306esites-available\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u65b0\u3057\u3044\u30b5\u30fc\u30d0\u30fc\u30d6\u30ed\u30c3\u30af\u3092\u4f5c\u6210\u3057\u3066\u958b\u304d\u59cb\u3081\u307e\u3059\u3002 (Nginx\u306esites-available\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u65b0\u3057\u3044\u30b5\u30fc\u30d0\u30fc\u30d6\u30ed\u30c3\u30af\u3092\u4f5c\u6210\u3057\u3066\u958b\u59cb\u3059\u308b\u3053\u3068\u304b\u3089\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\/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>\u5185\u90e8\u3067\u3001\u65b0\u3057\u3044\u30b5\u30fc\u30d0\u30fc\u30d6\u30ed\u30c3\u30af\u3092\u958b\u304d\u307e\u3059\u3002\u307e\u305a\u3001\u3053\u306e\u30d6\u30ed\u30c3\u30af\u304c\u901a\u5e38\u306e\u30dd\u30fc\u30c880\u3067\u5f85\u3061\u53d7\u3051\u308b\u3088\u3046\u306b\u6307\u5b9a\u3057\u3001\u30b5\u30fc\u30d0\u30fc\u306e\u30c9\u30e1\u30a4\u30f3\u540d\u307e\u305f\u306fIP\u30a2\u30c9\u30ec\u30b9\u306b\u5fdc\u7b54\u3059\u308b\u3088\u3046\u306b\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>server_domain_or_IP<\/mark>;\r\n}\r\n<\/code><\/pre>\n<p>\u6b21\u306b\u3001Nginx\u306b\u306f\u30d5\u30a1\u30d3\u30b3\u30f3\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u3068\u3044\u3046\u554f\u984c\u3092\u7121\u8996\u3059\u308b\u3088\u3046\u306b\u6307\u793a\u3057\u307e\u3059\u3002\u307e\u305f\u3001~ \/ myprojectdir \/ static\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u53ce\u96c6\u3057\u305f\u9759\u7684\u30a2\u30bb\u30c3\u30c8\u306e\u5834\u6240\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u3059\u3079\u3066\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u6a19\u6e96\u7684\u306aURI\u30d7\u30ec\u30d5\u30a3\u30c3\u30af\u30b9\u306f&#8221;\/static&#8221;\u3067\u3059\u306e\u3067\u3001\u305d\u308c\u3089\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u4e00\u81f4\u3059\u308b\u3088\u3046\u306b\u30ed\u30b1\u30fc\u30b7\u30e7\u30f3\u30d6\u30ed\u30c3\u30af\u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n<div>\u300c\/etc\/nginx\/sites-available\/myproject\u300d\u3068\u3044\u3046\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30d1\u30b9\u3092\u65e5\u672c\u8a9e\u3067\u8868\u73fe\u3059\u308b\u3068\u3001\u300c\/etc\/nginx\/sites-available\/myproject\u300d\u3068\u306a\u308a\u307e\u3059\u3002<\/div>\n<pre class=\"post-pre\"><code>server {\r\n    listen 80;\r\n    server_name server_domain_or_IP;\r\n\r\n    location = \/favicon.ico { access_log off; log_not_found off; }\r\n    location \/static\/ {\r\n        root \/home\/<mark>sammy<\/mark>\/<mark>myprojectdir<\/mark>;\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>\u6700\u5f8c\u306b\u3001\u4ed6\u306e\u3059\u3079\u3066\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u4e00\u81f4\u3059\u308b\u30ed\u30b1\u30fc\u30b7\u30e7\u30f3\/ {}\u30d6\u30ed\u30c3\u30af\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u3053\u306e\u30ed\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u5185\u90e8\u306b\u3001Nginx\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306b\u542b\u307e\u308c\u308b\u6a19\u6e96\u306e\u30d7\u30ed\u30ad\u30b7\u30d1\u30e9\u30e0\u30d5\u30a1\u30a4\u30eb\u3092\u542b\u3081\u3001\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\u3092\u76f4\u63a5Gunicorn\u306e\u30bd\u30b1\u30c3\u30c8\u306b\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 server_domain_or_IP;\r\n\r\n    location = \/favicon.ico { access_log off; log_not_found off; }\r\n    location \/static\/ {\r\n        root \/home\/sammy\/myprojectdir;\r\n    }\r\n\r\n    location \/ {\r\n        include proxy_params;\r\n        proxy_pass http:\/\/unix:\/run\/gunicorn.sock;\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>\u4f5c\u696d\u304c\u7d42\u308f\u3063\u305f\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3057\u3066\u9589\u3058\u3066\u304f\u3060\u3055\u3044\u3002\u305d\u3057\u3066\u3001\u30b5\u30a4\u30c8\u306e\u6709\u52b9\u5316\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u30ea\u30f3\u30af\u3059\u308b\u3053\u3068\u3067\u30d5\u30a1\u30a4\u30eb\u3092\u6709\u52b9\u306b\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> <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>\u69cb\u6587\u30a8\u30e9\u30fc\u304c\u306a\u3044\u304bNginx\u306e\u8a2d\u5b9a\u3092\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306b\u3001\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 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>\u30a8\u30e9\u30fc\u304c\u5831\u544a\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u3001\u6b21\u306e\u3088\u3046\u306b\u3057\u3066Nginx\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\u5f8c\u306b\u3001\u30dd\u30fc\u30c880\u3067\u6b63\u5e38\u306a\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\u3092\u53d7\u3051\u5165\u308c\u308b\u305f\u3081\u306b\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u3092\u958b\u653e\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u958b\u767a\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u30a2\u30af\u30bb\u30b9\u306f\u4e0d\u8981\u306b\u306a\u3063\u305f\u306e\u3067\u3001\u30dd\u30fc\u30c88000\u3092\u958b\u304f\u30eb\u30fc\u30eb\u3092\u524a\u9664\u3059\u308b\u3053\u3068\u3082\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> ufw delete allow <span class=\"token number\">8000<\/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>\u3042\u306a\u305f\u306f\u4eca\u3001\u30b5\u30fc\u30d0\u30fc\u306e\u30c9\u30e1\u30a4\u30f3\u307e\u305f\u306fIP\u30a2\u30c9\u30ec\u30b9\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u8868\u793a\u3067\u304d\u308b\u306f\u305a\u3067\u3059\u3002<\/p>\n<div class=\"post-conf-note\">\n<p class=\"post-conf-desc\">Note<\/p>\n<div>\u6ce8\u610f\uff1aNginx\u306e\u8a2d\u5b9a\u5f8c\u3001\u6b21\u306e\u30b9\u30c6\u30c3\u30d7\u306fSSL\/TLS\u3092\u4f7f\u7528\u3057\u3066\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u901a\u4fe1\u3092\u4fdd\u8b77\u3059\u308b\u3053\u3068\u3067\u3059\u3002\u3053\u308c\u306f\u91cd\u8981\u3067\u3059\u3002\u306a\u305c\u306a\u3089\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u542b\u3080\u3059\u3079\u3066\u306e\u60c5\u5831\u304c\u5e73\u6587\u3067\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u4e0a\u306b\u9001\u4fe1\u3055\u308c\u308b\u305f\u3081\u3067\u3059\u3002<br \/>\n\u30c9\u30e1\u30a4\u30f3\u540d\u304c\u3042\u308b\u5834\u5408\u3001\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\u3092\u4fdd\u8b77\u3059\u308b\u305f\u3081\u306eSSL\u8a3c\u660e\u66f8\u3092\u53d6\u5f97\u3059\u308b\u6700\u3082\u76f4\u63a5\u7684\u306a\u65b9\u6cd5\u306f\u3001Let&#8217;s Encrypt\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3059\u3002\u3053\u306e\u30ac\u30a4\u30c9\u306b\u5f93\u3063\u3066\u3001Debian 11\u4e0a\u306eNginx\u3067Let&#8217;s Encrypt\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u306e\u30ac\u30a4\u30c9\u3067\u4f5c\u6210\u3057\u305fNginx\u306e\u30b5\u30fc\u30d0\u30fc\u30d6\u30ed\u30c3\u30af\u3092\u4f7f\u7528\u3057\u3066\u624b\u7d9a\u304d\u306b\u5f93\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/div>\n<\/div>\n<h2>Nginx\u3068Gunicorn\u306e\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0<\/h2>\n<p>\u3082\u3057\u3053\u306e\u6700\u5f8c\u306e\u30b9\u30c6\u30c3\u30d7\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u5834\u5408\u306f\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306e\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<h3>Nginx\u306fDjango\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u4ee3\u308f\u308a\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30da\u30fc\u30b8\u3092\u8868\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/h3>\n<p>Nginx\u304c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u30d7\u30ed\u30ad\u30b7\u3059\u308b\u4ee3\u308f\u308a\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30da\u30fc\u30b8\u3092\u8868\u793a\u3059\u308b\u5834\u5408\u3001\u901a\u5e38\u306f\/etc\/nginx\/sites-available\/myproject\u30d5\u30a1\u30a4\u30eb\u5185\u306eserver_name\u3092\u8abf\u6574\u3057\u3066\u3001\u30b5\u30fc\u30d0\u30fc\u306eIP\u30a2\u30c9\u30ec\u30b9\u307e\u305f\u306f\u30c9\u30e1\u30a4\u30f3\u540d\u306b\u30dd\u30a4\u30f3\u30c8\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>Nginx\u306f\u3001server_name\u3092\u4f7f\u7528\u3057\u3066\u3069\u306e\u30b5\u30fc\u30d0\u30fc\u30d6\u30ed\u30c3\u30af\u3092\u4f7f\u7528\u3057\u3066\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u5fdc\u7b54\u3059\u308b\u304b\u3092\u5224\u65ad\u3057\u307e\u3059\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306eNginx\u30da\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u308b\u5834\u5408\u3001Nginx\u306f\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u660e\u793a\u7684\u306b\u30b5\u30fc\u30d0\u30fc\u30d6\u30ed\u30c3\u30af\u306b\u30de\u30c3\u30c1\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u304b\u3063\u305f\u8a3c\u62e0\u3067\u3059\u3002\u305d\u306e\u305f\u3081\u3001Nginx\u306f\/etc\/nginx\/sites-available\/default\u3067\u5b9a\u7fa9\u3055\u308c\u305f\u30c7\u30d5\u30a9\u30eb\u30c8\u30d6\u30ed\u30c3\u30af\u306b\u30d5\u30a9\u30fc\u30eb\u30d0\u30c3\u30af\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306eserver\u30d6\u30ed\u30c3\u30af\u5185\u306eserver_name\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306eserver\u30d6\u30ed\u30c3\u30af\u5185\u306e\u3082\u306e\u3088\u308a\u3082\u5177\u4f53\u7684\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u308c\u306b\u3088\u3063\u3066\u9078\u629e\u3055\u308c\u307e\u3059\u3002<\/p>\n<h3>Nginx\u306f\u3001Django\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u4ee3\u308f\u308a\u306b502 Bad Gateway\u30a8\u30e9\u30fc\u3092\u8868\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/h3>\n<p>502\u30a8\u30e9\u30fc\u306f\u3001Nginx\u304c\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u6b63\u5e38\u306b\u30d7\u30ed\u30ad\u30b7\u3067\u304d\u306a\u3044\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002\u69d8\u3005\u306a\u8a2d\u5b9a\u306e\u554f\u984c\u304c502\u30a8\u30e9\u30fc\u3068\u3057\u3066\u73fe\u308c\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u9069\u5207\u306b\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u3059\u308b\u305f\u3081\u306b\u306f\u8a73\u7d30\u306a\u60c5\u5831\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<p>\u8a73\u7d30\u306a\u60c5\u5831\u3092\u63a2\u3059\u305f\u3081\u306e\u4e3b\u8981\u306a\u5834\u6240\u306f\u3001Nginx\u306e\u30a8\u30e9\u30fc\u30ed\u30b0\u3067\u3059\u3002\u901a\u5e38\u3001\u3053\u308c\u306b\u3088\u3063\u3066\u30d7\u30ed\u30ad\u30b7\u30a4\u30d9\u30f3\u30c8\u4e2d\u306b\u554f\u984c\u304c\u767a\u751f\u3057\u305f\u6761\u4ef6\u304c\u308f\u304b\u308a\u307e\u3059\u3002Nginx\u306e\u30a8\u30e9\u30fc\u30ed\u30b0\u3092\u78ba\u8a8d\u3059\u308b\u306b\u306f\u3001\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 function\">sudo<\/span> <span class=\"token function\">tail<\/span> <span class=\"token parameter variable\">-F<\/span> \/var\/log\/nginx\/error.log<\/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\u3001\u30d6\u30e9\u30a6\u30b6\u3067\u5225\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u884c\u3044\u3001\u65b0\u3057\u3044\u30a8\u30e9\u30fc\u3092\u751f\u6210\u3057\u3066\u304f\u3060\u3055\u3044\uff08\u30da\u30fc\u30b8\u3092\u30ea\u30d5\u30ec\u30c3\u30b7\u30e5\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\uff09\u3002\u30ed\u30b0\u306b\u8a18\u8f09\u3055\u308c\u308b\u65b0\u3057\u3044\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u53d7\u3051\u53d6\u308b\u306f\u305a\u3067\u3059\u3002\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u898b\u308b\u3068\u3001\u554f\u984c\u306e\u7279\u5b9a\u306b\u5f79\u7acb\u3064\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u53d7\u3051\u53d6\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>unix:\/run\/gunicorn.sock \u3078\u306e connect() \u304c\u5931\u6557\u3057\u307e\u3057\u305f (2: \u30d5\u30a1\u30a4\u30eb\u3084\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u5b58\u5728\u3057\u307e\u305b\u3093)\u3002<\/p>\n<p>\u3053\u308c\u306f\u3001Nginx\u304c\u6307\u5b9a\u3055\u308c\u305f\u5834\u6240\u306b\u3042\u308bgunicorn.sock\u30d5\u30a1\u30a4\u30eb\u3092\u898b\u3064\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u304b\u3063\u305f\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002\/etc\/nginx\/sites-available\/myproject\u30d5\u30a1\u30a4\u30eb\u5185\u3067\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308bproxy_pass\u306e\u5834\u6240\u3068\u3001gunicorn.socket systemd\u30e6\u30cb\u30c3\u30c8\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u305fgunicorn.sock\u30d5\u30a1\u30a4\u30eb\u306e\u5b9f\u969b\u306e\u5834\u6240\u3092\u6bd4\u8f03\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\/run\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306bgunicorn.sock\u30d5\u30a1\u30a4\u30eb\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u3001\u901a\u5e38systemd\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3067\u304d\u306a\u304b\u3063\u305f\u3053\u3068\u3092\u610f\u5473\u3057\u307e\u3059\u3002Gunicorn\u306e\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u624b\u9806\u3092\u9032\u3081\u308b\u305f\u3081\u3001Gunicorn\u306e\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u78ba\u8a8d\u3059\u308b\u30bb\u30af\u30b7\u30e7\u30f3\u306b\u623b\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>unix:\/run\/gunicorn.sock\u3078\u306econnect()\u306b\u5931\u6557\u3057\u307e\u3057\u305f\uff0813: \u8a31\u53ef\u304c\u62d2\u5426\u3055\u308c\u307e\u3057\u305f\uff09<\/p>\n<p>Nginx\u304cGunicorn\u30bd\u30b1\u30c3\u30c8\u306b\u63a5\u7d9a\u3067\u304d\u306a\u304b\u3063\u305f\u306e\u306f\u3001\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u306e\u554f\u984c\u306e\u305f\u3081\u3067\u3059\u3002root\u30e6\u30fc\u30b6\u30fc\u3067\u306f\u306a\u304fsudo\u30e6\u30fc\u30b6\u30fc\u3092\u4f7f\u7528\u3057\u3066\u624b\u9806\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u3053\u308c\u304c\u8d77\u3053\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002systemd\u306fGunicorn\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3067\u304d\u308b\u4e00\u65b9\u3001Nginx\u306f\u305d\u308c\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p>\u3082\u3057\u3001root\u30c7\u30a3\u30ec\u30af\u30c8\u30ea(\/)\u3068gunicorn.sock\u30d5\u30a1\u30a4\u30eb\u306e\u9593\u306e\u3044\u305a\u308c\u304b\u306e\u30dd\u30a4\u30f3\u30c8\u3067\u6a29\u9650\u304c\u5236\u9650\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u3001\u3053\u308c\u306f\u8d77\u3053\u308a\u5f97\u307e\u3059\u3002 socket\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u305d\u308c\u305e\u308c\u306e\u89aa\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u6240\u6709\u6a29\u3068\u6a29\u9650\u306e\u5024\u3092\u78ba\u8a8d\u3059\u308b\u306b\u306f\u3001socket\u30d5\u30a1\u30a4\u30eb\u3078\u306e\u7d76\u5bfe\u30d1\u30b9\u3092namei\u30b3\u30de\u30f3\u30c9\u306b\u6e21\u3059\u3053\u3068\u3067\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">namei <span class=\"token parameter variable\">-l<\/span> \/run\/gunicorn.sock<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\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>f: \/run\/gunicorn.sock drwxr-xr-x root root \/ drwxr-xr-x root root run srw-rw-rw- root root gunicorn.sock<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u51fa\u529b\u306f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u5404\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u6a29\u9650\u3092\u8868\u793a\u3057\u307e\u3059\u3002\u6a29\u9650\uff08\u6700\u521d\u306e\u5217\uff09\u3001\u6240\u6709\u8005\uff082\u756a\u76ee\u306e\u5217\uff09\u3001\u304a\u3088\u3073\u30b0\u30eb\u30fc\u30d7\u6240\u6709\u8005\uff083\u756a\u76ee\u306e\u5217\uff09\u3092\u898b\u308b\u3053\u3068\u3067\u3001\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u3078\u306e\u30a2\u30af\u30bb\u30b9\u30bf\u30a4\u30d7\u3092\u5224\u65ad\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4e0a\u8a18\u306e\u4f8b\u3067\u306f\u3001\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u3068\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u81f3\u308b\u307e\u3067\u306e\u5404\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u306f\u3001\u4e16\u754c\u8aad\u307f\u53d6\u308a\u304a\u3088\u3073\u5b9f\u884c\u306e\u6a29\u9650\uff08\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u6a29\u9650\u5217\u306fr-x\u3067\u7d42\u308f\u308b\uff09\u304c\u4e0e\u3048\u3089\u308c\u3066\u3044\u307e\u3059\u3002Nginx\u30d7\u30ed\u30bb\u30b9\u306f\u30bd\u30b1\u30c3\u30c8\u306b\u6b63\u5e38\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u306f\u305a\u3067\u3059\u3002<\/p>\n<p>\u30bd\u30b1\u30c3\u30c8\u306b\u81f3\u308b\u307e\u3067\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u3044\u305a\u308c\u304b\u306b\u3001\u30ef\u30fc\u30eb\u30c9\u306e\u8aad\u307f\u53d6\u308a\u304a\u3088\u3073\u5b9f\u884c\u6a29\u9650\u304c\u306a\u3044\u5834\u5408\u3001Nginx\u306f\u30ef\u30fc\u30eb\u30c9\u3078\u306e\u8aad\u307f\u53d6\u308a\u304a\u3088\u3073\u5b9f\u884c\u6a29\u9650\u3092\u8a31\u53ef\u3059\u308b\u304b\u3001Nginx\u304c\u6240\u5c5e\u3057\u3066\u3044\u308b\u30b0\u30eb\u30fc\u30d7\u306b\u30b0\u30eb\u30fc\u30d7\u6240\u6709\u6a29\u3092\u4e0e\u3048\u308b\u3053\u3068\u306a\u304f\u3001\u30bd\u30b1\u30c3\u30c8\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<h3>Django\u304c\u8868\u793a\u3057\u3066\u3044\u307e\u3059:\u300c\u30b5\u30fc\u30d0\u30fc\u306b\u63a5\u7d9a\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\uff1a\u63a5\u7d9a\u304c\u62d2\u5426\u3055\u308c\u307e\u3057\u305f\u300d<\/h3>\n<p>\u30a6\u30a7\u30d6\u30d6\u30e9\u30a6\u30b6\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u4e00\u90e8\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3088\u3046\u3068\u3057\u305f\u969b\u306b\u3001Django\u304b\u3089\u53d7\u3051\u53d6\u308b\u3053\u3068\u304c\u3042\u308b\u30e1\u30c3\u30bb\u30fc\u30b8\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>OperationalError at \/admin\/login\/\r\ncould not connect to server: Connection refused\r\n    Is the server running on host \"localhost\" (127.0.0.1) and accepting\r\n    TCP\/IP connections on port 5432?\r\n<\/code><\/pre>\n<p>\u3053\u308c\u306f\u3001Django\u304cPostgres\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\u3067\u304d\u306a\u3044\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002Postgres\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\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> systemctl status postgresql<\/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\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u306a\u3051\u308c\u3070\u3001\u8d77\u52d5\u6642\u306b\u81ea\u52d5\u7684\u306b\u958b\u59cb\u3059\u308b\u3088\u3046\u306b\u3001\u624b\u52d5\u3067\u8d77\u52d5\u3059\u308b\u3053\u3068\u3082\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 postgresql<\/li>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> systemctl <span class=\"token builtin class-name\">enable<\/span> postgresql<\/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\u307e\u3060\u554f\u984c\u304c\u3042\u308b\u5834\u5408\u306f\u3001~\/myprojectdir\/myproject\/settings.py \u30d5\u30a1\u30a4\u30eb\u3067\u5b9a\u7fa9\u3055\u308c\u305f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u8a2d\u5b9a\u304c\u6b63\u3057\u3044\u304b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>\u8ffd\u52a0\u306e\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0<\/h3>\n<p>\u8ffd\u52a0\u306e\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u306b\u306f\u3001\u30ed\u30b0\u304c\u539f\u56e0\u306e\u7d5e\u308a\u8fbc\u307f\u306b\u5f79\u7acb\u3061\u307e\u3059\u3002\u305d\u308c\u305e\u308c\u3092\u9806\u756a\u306b\u78ba\u8a8d\u3057\u3001\u554f\u984c\u7b87\u6240\u3092\u793a\u3059\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u63a2\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>(Additional troubleshooting\u306e\u90e8\u5206\u3092\u4fee\u6b63\u3057\u307e\u3057\u305f)<\/p>\n<p>\u6b21\u306e\u30ed\u30b0\u304c\u5f79\u7acb\u3064\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<ul class=\"post-ul\">\n<li>Check the Nginx process logs by typing: sudo journalctl -u nginx<\/li>\n<li>Check the Nginx access logs by typing: sudo less \/var\/log\/nginx\/access.log<\/li>\n<li>Check the Nginx error logs by typing: sudo less \/var\/log\/nginx\/error.log<\/li>\n<li>Check the Gunicorn application logs by typing: sudo journalctl -u gunicorn<\/li>\n<li>Check the Gunicorn socket logs by typing: sudo journalctl -u gunicorn.socket<\/li>\n<\/ul>\n<p>\u8a2d\u5b9a\u3084\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u66f4\u65b0\u3059\u308b\u969b\u306b\u306f\u3001\u5909\u66f4\u3092\u53cd\u6620\u3055\u305b\u308b\u305f\u3081\u306b\u304a\u305d\u3089\u304f\u30d7\u30ed\u30bb\u30b9\u306e\u518d\u8d77\u52d5\u304c\u5fc5\u8981\u306b\u306a\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>Django\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u66f4\u65b0\u3057\u305f\u3089\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u3066Gunicorn\u30d7\u30ed\u30bb\u30b9\u3092\u518d\u8d77\u52d5\u3059\u308b\u3053\u3068\u3067\u3001\u5909\u66f4\u5185\u5bb9\u3092\u53cd\u6620\u3055\u305b\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 restart gunicorn<\/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>Gunicorn\u306e\u30bd\u30b1\u30c3\u30c8\u3084\u30b5\u30fc\u30d3\u30b9\u30d5\u30a1\u30a4\u30eb\u3092\u5909\u66f4\u3057\u305f\u5834\u5408\u306f\u3001\u30c7\u30fc\u30e2\u30f3\u3092\u30ea\u30ed\u30fc\u30c9\u3057\u3001\u30d7\u30ed\u30bb\u30b9\u3092\u518d\u8d77\u52d5\u3059\u308b\u305f\u3081\u306b\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 function\">sudo<\/span> systemctl daemon-reload<\/li>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> systemctl restart gunicorn.socket gunicorn.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>Nginx\u306e\u30b5\u30fc\u30d0\u30fc\u30d6\u30ed\u30c3\u30af\u8a2d\u5b9a\u3092\u5909\u66f4\u3057\u305f\u5834\u5408\u306f\u3001\u8a2d\u5b9a\u3092\u30c6\u30b9\u30c8\u3057\u3001Nginx\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> nginx <span class=\"token parameter variable\">-t<\/span> <span class=\"token operator\">&amp;&amp;<\/span> <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>\u69cb\u6210\u3092\u8abf\u6574\u3059\u308b\u904e\u7a0b\u3067\u5909\u66f4\u70b9\u3092\u628a\u63e1\u3059\u308b\u305f\u3081\u306b\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u304c\u5f79\u7acb\u3061\u307e\u3059\u3002<\/p>\n<h2>\u7d50\u8ad6<\/h2>\n<p>\u3053\u306e\u30ac\u30a4\u30c9\u3067\u306f\u3001Django\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u72ec\u81ea\u306e\u4eee\u60f3\u74b0\u5883\u3067\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3057\u307e\u3059\u3002\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u51e6\u7406\u3059\u308b\u305f\u3081\u306b\u3001Gunicorn\u3092\u8a2d\u5b9a\u3057\u3066\u7ffb\u8a33\u3057\u307e\u3059\u3002\u305d\u306e\u5f8c\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306e\u63a5\u7d9a\u3092\u51e6\u7406\u3057\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u5fdc\u3058\u3066\u6b63\u3057\u3044\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u63d0\u4f9b\u3059\u308b\u9006\u30d7\u30ed\u30ad\u30b7\u3068\u3057\u3066Nginx\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3057\u307e\u3059\u3002<\/p>\n<p>Django\u306f\u3001\u591a\u304f\u306e\u5171\u901a\u306e\u8981\u7d20\u3092\u63d0\u4f9b\u3059\u308b\u3053\u3068\u3067\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3084\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u4f5c\u6210\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002\u4e00\u822c\u7684\u306a\u30c4\u30fc\u30eb\u30c1\u30a7\u30fc\u30f3\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u4f5c\u6210\u3057\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5358\u4e00\u306e\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u63d0\u4f9b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u306f\u3058\u3081\u306b Django\u306f\u3001Python\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3084\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u3092\u7acb\u3061\u4e0a\u3052\u308b\u306e\u306b\u5f79\u7acb\u3064\u5f37\u529b\u306a\u30a6\u30a7\u30d6\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002Django\u306b\u306f\u3001\u30b3\u30fc\u30c9\u3092\u30ed\u30fc\u30ab\u30eb\u3067\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306e\u958b\u767a\u30b5\u30fc\u30d0\u30fc\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u672c\u756a\u306b\u95a2\u9023\u3059 [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-227","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"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>\u30c7\u30d3\u30a2\u30f311\u3067Django\u3092Postgres\u3001Nginx\u3001Gunicorn\u3068\u5171\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u65b9\u6cd5 - Blog - Silicon Cloud<\/title>\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\/\u30c7\u30d3\u30a2\u30f311\u3067django\u3092postgres\u3001nginx\u3001gunicorn\u3068\u5171\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u30c7\u30d3\u30a2\u30f311\u3067Django\u3092Postgres\u3001Nginx\u3001Gunicorn\u3068\u5171\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u65b9\u6cd5\" \/>\n<meta property=\"og:description\" content=\"\u306f\u3058\u3081\u306b Django\u306f\u3001Python\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3084\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u3092\u7acb\u3061\u4e0a\u3052\u308b\u306e\u306b\u5f79\u7acb\u3064\u5f37\u529b\u306a\u30a6\u30a7\u30d6\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002Django\u306b\u306f\u3001\u30b3\u30fc\u30c9\u3092\u30ed\u30fc\u30ab\u30eb\u3067\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306e\u958b\u767a\u30b5\u30fc\u30d0\u30fc\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u672c\u756a\u306b\u95a2\u9023\u3059 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/ja\/blog\/\u30c7\u30d3\u30a2\u30f311\u3067django\u3092postgres\u3001nginx\u3001gunicorn\u3068\u5171\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-30T13:21:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-19T14:15:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656477dbdaa94e2bdf7b826c\/87-0.png\" \/>\n<meta name=\"author\" content=\"\u685c, \u6625\u6a39\" \/>\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=\"\u685c, \u6625\u6a39\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"7\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\/%e3%83%87%e3%83%93%e3%82%a2%e3%83%b311%e3%81%a7django%e3%82%92postgres%e3%80%81nginx%e3%80%81gunicorn%e3%81%a8%e5%85%b1%e3%81%ab%e3%82%bb%e3%83%83%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%e3%81%99%e3%82%8b\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%87%e3%83%93%e3%82%a2%e3%83%b311%e3%81%a7django%e3%82%92postgres%e3%80%81nginx%e3%80%81gunicorn%e3%81%a8%e5%85%b1%e3%81%ab%e3%82%bb%e3%83%83%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%e3%81%99%e3%82%8b\/\",\"name\":\"\u30c7\u30d3\u30a2\u30f311\u3067Django\u3092Postgres\u3001Nginx\u3001Gunicorn\u3068\u5171\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u65b9\u6cd5 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2023-11-30T13:21:04+00:00\",\"dateModified\":\"2024-03-19T14:15:29+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%87%e3%83%93%e3%82%a2%e3%83%b311%e3%81%a7django%e3%82%92postgres%e3%80%81nginx%e3%80%81gunicorn%e3%81%a8%e5%85%b1%e3%81%ab%e3%82%bb%e3%83%83%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%e3%81%99%e3%82%8b\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%87%e3%83%93%e3%82%a2%e3%83%b311%e3%81%a7django%e3%82%92postgres%e3%80%81nginx%e3%80%81gunicorn%e3%81%a8%e5%85%b1%e3%81%ab%e3%82%bb%e3%83%83%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%e3%81%99%e3%82%8b\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%87%e3%83%93%e3%82%a2%e3%83%b311%e3%81%a7django%e3%82%92postgres%e3%80%81nginx%e3%80%81gunicorn%e3%81%a8%e5%85%b1%e3%81%ab%e3%82%bb%e3%83%83%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%e3%81%99%e3%82%8b\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u30c7\u30d3\u30a2\u30f311\u3067Django\u3092Postgres\u3001Nginx\u3001Gunicorn\u3068\u5171\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u65b9\u6cd5\"}]},{\"@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\/ff22288af1a5455571aff7586b0fb341\",\"name\":\"\u685c, \u6625\u6a39\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g\",\"caption\":\"\u685c, \u6625\u6a39\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/sakuraharuki\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%87%e3%83%93%e3%82%a2%e3%83%b311%e3%81%a7django%e3%82%92postgres%e3%80%81nginx%e3%80%81gunicorn%e3%81%a8%e5%85%b1%e3%81%ab%e3%82%bb%e3%83%83%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%e3%81%99%e3%82%8b\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u30c7\u30d3\u30a2\u30f311\u3067Django\u3092Postgres\u3001Nginx\u3001Gunicorn\u3068\u5171\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u65b9\u6cd5 - Blog - Silicon Cloud","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\/\u30c7\u30d3\u30a2\u30f311\u3067django\u3092postgres\u3001nginx\u3001gunicorn\u3068\u5171\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\/","og_locale":"ja_JP","og_type":"article","og_title":"\u30c7\u30d3\u30a2\u30f311\u3067Django\u3092Postgres\u3001Nginx\u3001Gunicorn\u3068\u5171\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u65b9\u6cd5","og_description":"\u306f\u3058\u3081\u306b Django\u306f\u3001Python\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3084\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u3092\u7acb\u3061\u4e0a\u3052\u308b\u306e\u306b\u5f79\u7acb\u3064\u5f37\u529b\u306a\u30a6\u30a7\u30d6\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002Django\u306b\u306f\u3001\u30b3\u30fc\u30c9\u3092\u30ed\u30fc\u30ab\u30eb\u3067\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306e\u958b\u767a\u30b5\u30fc\u30d0\u30fc\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u672c\u756a\u306b\u95a2\u9023\u3059 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/ja\/blog\/\u30c7\u30d3\u30a2\u30f311\u3067django\u3092postgres\u3001nginx\u3001gunicorn\u3068\u5171\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-11-30T13:21:04+00:00","article_modified_time":"2024-03-19T14:15:29+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656477dbdaa94e2bdf7b826c\/87-0.png"}],"author":"\u685c, \u6625\u6a39","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u685c, \u6625\u6a39","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"7\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%87%e3%83%93%e3%82%a2%e3%83%b311%e3%81%a7django%e3%82%92postgres%e3%80%81nginx%e3%80%81gunicorn%e3%81%a8%e5%85%b1%e3%81%ab%e3%82%bb%e3%83%83%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%e3%81%99%e3%82%8b\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%87%e3%83%93%e3%82%a2%e3%83%b311%e3%81%a7django%e3%82%92postgres%e3%80%81nginx%e3%80%81gunicorn%e3%81%a8%e5%85%b1%e3%81%ab%e3%82%bb%e3%83%83%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%e3%81%99%e3%82%8b\/","name":"\u30c7\u30d3\u30a2\u30f311\u3067Django\u3092Postgres\u3001Nginx\u3001Gunicorn\u3068\u5171\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u65b9\u6cd5 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2023-11-30T13:21:04+00:00","dateModified":"2024-03-19T14:15:29+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%87%e3%83%93%e3%82%a2%e3%83%b311%e3%81%a7django%e3%82%92postgres%e3%80%81nginx%e3%80%81gunicorn%e3%81%a8%e5%85%b1%e3%81%ab%e3%82%bb%e3%83%83%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%e3%81%99%e3%82%8b\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%87%e3%83%93%e3%82%a2%e3%83%b311%e3%81%a7django%e3%82%92postgres%e3%80%81nginx%e3%80%81gunicorn%e3%81%a8%e5%85%b1%e3%81%ab%e3%82%bb%e3%83%83%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%e3%81%99%e3%82%8b\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%87%e3%83%93%e3%82%a2%e3%83%b311%e3%81%a7django%e3%82%92postgres%e3%80%81nginx%e3%80%81gunicorn%e3%81%a8%e5%85%b1%e3%81%ab%e3%82%bb%e3%83%83%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%e3%81%99%e3%82%8b\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"\u30c7\u30d3\u30a2\u30f311\u3067Django\u3092Postgres\u3001Nginx\u3001Gunicorn\u3068\u5171\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u65b9\u6cd5"}]},{"@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\/ff22288af1a5455571aff7586b0fb341","name":"\u685c, \u6625\u6a39","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g","caption":"\u685c, \u6625\u6a39"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/sakuraharuki\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%87%e3%83%93%e3%82%a2%e3%83%b311%e3%81%a7django%e3%82%92postgres%e3%80%81nginx%e3%80%81gunicorn%e3%81%a8%e5%85%b1%e3%81%ab%e3%82%bb%e3%83%83%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%e3%81%99%e3%82%8b\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/227","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\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=227"}],"version-history":[{"count":1,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/227\/revisions"}],"predecessor-version":[{"id":37950,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/227\/revisions\/37950"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}