{"id":5929,"date":"2020-09-07T17:01:27","date_gmt":"2020-09-07T08:01:27","guid":{"rendered":"http:\/\/hack.gpl.jp\/?p=5929"},"modified":"2020-09-07T17:01:27","modified_gmt":"2020-09-07T08:01:27","slug":"post-5929","status":"publish","type":"post","link":"https:\/\/hack.gpl.jp\/2020\/09\/07\/post-5929.html","title":{"rendered":"\u30dd\u30fc\u30c8\u30d5\u30a9\u30ef\u30fc\u30c9\u306e\u7d4c\u8def\u3067\u3001U\u30bf\u30fc\u30f3 NAT\u3068\u304b\u30d8\u30a2\u30d4\u30f3NAT\u304c\u4f7f\u3048\u306a\u3044\u30eb\u30fc\u30bf\u306e\u5834\u5408\u306e\u3042\u308c\u3053\u308c"},"content":{"rendered":"\n

\u5148\u65e5\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u56f0\u3063\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n

Termux\u306eapache2+php+mariadb\u306e\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u524d\u306ewordpress\u306e\u901f\u5ea6\u3068\u304b<\/a>
\uff1a\uff1a
\u307e\u3041\u3001\u901f\u5ea6\u7684\u306a\u3053\u3068\u3088\u308a\u56f0\u3063\u3066\u3044\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u308c\u306f\u3001\u30ed\u30fc\u30ab\u30eb\u306e\u30de\u30b7\u30f3\u304b\u3089\u3001termux\u4e0a\u3067\u52d5\u4f5c\u3057\u3066\u3044\u308bwordpress\u306b\u30b0\u30ed\u30fc\u30d0\u30ebIP\u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u306a\u3044\u3053\u3068\u3067\u3059\u3002\u3053\u306e\u5834\u5408\u3001\u30eb\u30fc\u30bf\u306e\u7ba1\u7406\u753b\u9762\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3061\u3083\u3046\u3093\u3067\u3001\u3069\u3046\u3057\u3088\u3046\u304b\u306a\u3068\u3002\u3053\u3046\u3044\u3046\u306e\u306a\u3093\u3066\u3044\u3046\u3093\u3067\u3057\u305f\u3063\u3051\u304b\uff1f\u3000\u3068\u306b\u304b\u304f\u3001\u4eca\u306e\u62e0\u70b9\u306e\u30eb\u30fc\u30bf\uff08PR-400KI\uff09\u306f\u3001\u5185\u5074\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u304b\u3089\u5916\u5074\u306e\u30b0\u30ed\u30fc\u30d0\u30eb\u30a2\u30c9\u30ec\u30b9\u306b\u30a2\u30af\u30bb\u30b9\u3057\u305f\u3082\u306e\u3092\u3001\u5909\u63db\uff08\u6700\u7d42\u7684\u306b\u30b5\u30fc\u30d0\u306e\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u30a2\u30c9\u30ec\u30b9\u306b\u5909\u63db\uff09\u3057\u3066\u304f\u308c\u306a\u3044\u306e\u3067\u3059\u3002<\/p><\/blockquote>\n\n\n\n

\u3053\u308c\u3001\u8a00\u8449\u3067\u66f8\u304f\u3068\u3088\u304f\u308f\u304b\u308a\u307e\u305b\u3093\u304c\u3001\u3069\u3093\u306a\u554f\u984c\u304b\u3068\u3044\u3046\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

\u3053\u3046\u3044\u3046\u8868\u73fe\u3068\u3057\u3066\u3001U\u30bf\u30fc\u30f3NAT<\/a><\/strong>\u3068\u304b\u3001\u30d8\u30a2\u30d4\u30f3NAT<\/a><\/strong>\u3068\u304b\u547c\u3076\u3088\u3046\u3067\u3059\u3002\u3053\u308c\u304c\u51fa\u6765\u308b\u30eb\u30fc\u30bf\u3068\u3067\u304d\u306a\u3044\u30eb\u30fc\u30bf\u304c\u3042\u308a\u3001NTT\u304b\u3089\u501f\u308a\u3066\u3044\u308b\u30eb\u30fc\u30bf\u3067\u306f\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u3044\u308d\u3044\u308d\u89e3\u6c7a\u65b9\u6cd5\u304c\u3042\u308b\u3068\u306f\u601d\u3044\u307e\u3059\u304c\u3001\u4e00\u756a\u7c21\u5358\u306a\u306e\u306f\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8PC\u3092VPN\u3067\u5916\u90e8\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3055\u305b\u308b\u65b9\u6cd5\u3067\u3059\u3002\u3064\u304f\u3070\u5927\u5b66\u306eVPN Gate<\/a><\/strong>\u3092\u4f7f\u3048\u3070\u7c21\u5358\u306b\u89e3\u6c7a\u3067\u304d\u307e\u3059\u304c\u3001\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u7d4c\u8def\u3068\u306a\u308a\u3044\u307e\u3044\u3061\u3067\u3059\u3002\u30d7\u30ec\u30a4\u30d9\u30fc\u30c8\u9593\u306e\u901a\u4fe1\u306a\u306e\u3067\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u3092\u7d4c\u7531\u3059\u308b\u65b9\u6cd5\u304c\u826f\u3055\u305d\u3046\u3067\u3059\u3002\u30dd\u30fc\u30c8\u5909\u63db\u304c\u306a\u3051\u308c\u3070\u3001hosts \u3092\u66f8\u304d\u63db\u3048\u308b\u304b\u3001\u5185\u90e8DNS\u3092\u7acb\u3061\u4e0a\u3052\u308c\u3070\u3044\u3044\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u306e\u5834\u5408\u306f\u3001\u30b9\u30de\u30db\u30b5\u30fc\u30d0\u3067\u63d0\u4f9b\u3057\u3066\u3044\u308b\u30dd\u30fc\u30c8\u306f8080\u3067\u3059\u300280\u30688080\u3092\u5bfe\u5fdc\u4ed8\u3051\u308b\u5fc5\u8981\u304c\u3042\u308a\u3001hosts \u3060\u3051\u3067\u306f\u7121\u7406\u306a\u306e\u3067\u3001\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u3092\u901a\u3057\u3066\u3001\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n

\u3000\u30d6\u30ed\u30b0\u306e\u66f4\u65b0\u306f\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8PC\u304b\u3089\u3057\u304b\u884c\u308f\u306a\u3044\u306e\u3067\u3053\u306ePC\u4e2d\u306b\u8a2d\u7f6e\u3057\u3066\u307f\u307e\u3057\u305f\u3002\u3082\u3061\u308d\u3093\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u3092\u5206\u96e2\u3057\u3066\u3001\u5185\u90e8DNS\u3092\u7acb\u3061\u4e0a\u3052\u308c\u3070\u3001\u7406\u8ad6\u4e0a\u306f\u4f55\u53f0\u3067\u3082\u9055\u3046\u30dd\u30fc\u30c8\u3068IP\u3092\u4f7f\u3063\u3066\u597d\u304d\u306a\u30c9\u30e1\u30a4\u30f3\u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002\u305d\u306e\u3046\u3061\u3001IoT\u30c7\u30d0\u30a4\u30b9\u3068\u304b\u3001\u30b9\u30de\u30db\u30b5\u30fc\u30d0\u3067\u30af\u30e9\u30b9\u30bf\u30ea\u30f3\u30b0\u3068\u304b\u30ed\u30fc\u30c9\u30d0\u30e9\u30f3\u30b5\u30fc\u3068\u304b\u4f7f\u3044\u51fa\u3057\u305f\u3089\u5185\u90e8DNS\u3084\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u306f\u6b32\u3057\u304f\u306a\u3063\u3066\u304f\u308b\u306e\u3067\u3059\u304c\u3001\u305d\u308c\u306f\u305d\u306e\u6642\u306b\u307e\u305f\u8003\u3048\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n

\u3000\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306b\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u3092\u4f5c\u3063\u3066\u3001\u30b9\u30de\u30db\u30b5\u30fc\u30d0\u306e8080\u30dd\u30fc\u30c8\u3067\u63d0\u4f9b\u3055\u308c\u3066\u3044\u308bWordPress \u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002\u5e78\u3044\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306fMac\u306a\u306e\u3067 nginx \u3068\u304b\u3067\u7c21\u5358\u306b\u4f5c\u308c\u307e\u3059\u3002<\/p>\n\n\n\n

Mac\u3067\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u3092nginx\u3067\u4f5c\u308b<\/h2>\n\n\n\n
\"\"<\/figure>\n\n\n\n

\u7d4c\u8def\u306e\u30a4\u30e1\u30fc\u30b8\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u3057\u3087\u3046\u304b\u3002\u307e\u305a\u306f\u3001nginx \u3092\u5165\u308c\u307e\u3059\u3002<\/p>\n\n\n\n

$ brew install nginx<\/code><\/pre>\n\n\n\n

\u8d77\u52d5\u3068\u518d\u8d77\u52d5\u3001\u505c\u6b62\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n

\u30fb\u8d77\u52d5\n$ sudo nginx\n\u30fb\u518d\u8d77\u52d5\n$ sudo nginx -s reload\n\u30fb\u505c\u6b62\n$ sudo nginx -s stop<\/code><\/pre>\n\n\n\n

\u8a2d\u5b9a\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u307e\u3059\u3002server_name\u3084\u3001proxy_pass\u306eIP\u3084\u30dd\u30fc\u30c8\u306a\u3069\u8aad\u307f\u66ff\u3048\u3066\u66f8\u304d\u63db\u3048\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n

\/usr\/local\/etc\/nginx\/nginx.conf\n::\nworker_processes 1;\nerror_log \/usr\/local\/var\/log\/nginx\/error.log;\n\nevents {\n  worker_connections  1024;\n}\n\nhttp {\n  # This should be in the same directory as this conf\n  # e.g. \/usr\/local\/etc\/nginx\n  include       mime.types;\n  default_type  application\/octet-stream;\n  \n  # Note this log_format is named 'main', and is used with the access log below\n  log_format   main '$remote_addr - $remote_user [$time_local]  $status '\n    '\"$request\" $body_bytes_sent \"$http_referer\" '\n    '\"$http_user_agent\" \"$http_x_forwarded_for\"';\n\n  sendfile        on;\n  keepalive_timeout  65;\n\n  # Without this I got this error: 'upstream sent too big header\n  # while reading response header from upstream'\n  proxy_buffer_size   128k;\n  proxy_buffers   4 256k;\n  proxy_busy_buffers_size   256k;\n\n  server {\n      listen 80;\n      server_name jh.gpl.jp;\n      proxy_set_header    Host    $host;\n      proxy_set_header    X-Real-IP    $remote_addr;\n      proxy_set_header    X-Forwarded-Host       $host;\n      proxy_set_header    X-Forwarded-Server    $http_host;\n      proxy_set_header    X-Forwarded-For    $proxy_add_x_forwarded_for;\n      access_log \/usr\/local\/var\/log\/nginx\/reverse-proxy.access.log  main;\n\n      location \/ {\n          proxy_pass         http:\/\/192.168.1.38:8080;\n      }\n  }\n}<\/code><\/pre>\n\n\n\n

hosts \u3092\u66f8\u304d\u63db\u3048\u307e\u3059\u3002<\/p>\n\n\n\n

$ cat \/etc\/hosts\n::\n127.0.0.1 jh.gpl.jp<\/code><\/pre>\n\n\n\n

nginx \u3092\u518d\u8d77\u52d5\u3057\u3066\u3001\u30d6\u30e9\u30a6\u30b6\u3067\u30c9\u30e1\u30a4\u30f3\u306b\u5bfe\u3057\u3066\u30a2\u30af\u30bb\u30b9\u3059\u308c\u3070OK\u3067\u3059\u3002<\/p>\n\n\n\n

\u3061\u306a\u307f\u306b\u3001wp-config.php \u306b\u4ee5\u4e0b\u3092\u8ffd\u8a18\u3059\u308b\u3068\u3001\u63a5\u7d9a\u5143\u304c192.168.1.26 \u306e\u6642\u3060\u3051WordPress \u306e\u30c9\u30e1\u30a4\u30f3\u540d\u304c www.gpl.jp \u306b\u66f8\u304d\u63db\u308f\u308a\u307e\u3059\u3002\u3082\u3061\u308d\u3093\u3001\u30a2\u30af\u30bb\u30b9\u3059\u308b\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306ehosts \u306f\u66f8\u304d\u63db\u3048\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n

if( $_SERVER['REMOTE_ADDR'] == '192.168.1.26' ){\n    define('WP_HOME','http:\/\/www.gpl.jp');\n    define('WP_SITEURL','http:\/\/www.gpl.jp');\n}<\/code><\/pre>\n\n\n\n

\u3068\u3044\u3046\u3053\u3068\u3067\u3001macos \u3067\u7c21\u5358\u306b\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u30fc\u3092\u7acb\u3061\u4e0a\u3052\u3066\u3001\u5185\u90e8\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u9055\u3046\u30dd\u30fc\u30c8\u3067\u63d0\u4f9b\u3055\u308c\u3066\u3044\u308bWordPress \u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u65b9\u6cd5\u3067\u3057\u305f\u3002<\/p>\n\n\n\n

Lan\u5185\u90e8\u306e\u30b9\u30de\u30db\u304b\u3089\u3082\u30a2\u30af\u30bb\u30b9\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u5185\u90e8DNS\u3092DHCP\u3067\u914d\u5e03\u3057\u3066\u3001\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u30fc\u3068\u5bfe\u5fdc\u4ed8\u3051\u3057\u306a\u3044\u3068\u3060\u3081\u3067\u3059\u306e\u3067\u3001\u5b8c\u74a7\u3092\u6c42\u3081\u308b\u306a\u3089\u305d\u308c\u3089\u304c\u5fc5\u8981\u3067\u3059\u3002\u305d\u306e\u3046\u3061\u3001\u4f5c\u308b\u6a5f\u4f1a\u304c\u3042\u308c\u3070\u7d39\u4ecb\u3057\u305f\u3044\u306a\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n

<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5148\u65e5\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u56f0\u3063\u3066\u3044\u307e\u3057\u305f\u3002 Termux\u306eapache2+php+mariadb\u306e\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u524d\u306ewordpress\u306e\u901f\u5ea6\u3068\u304b\uff1a\uff1a\u307e\u3041\u3001\u901f\u5ea6\u7684\u306a\u3053\u3068\u3088\u308a\u56f0\u3063\u3066\u3044\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u308c\u306f\u3001\u30ed\u30fc\u30ab\u30eb\u306e\u30de\u30b7\u30f3\u304b\u3089\u3001te […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","footnotes":""},"categories":[47,62,83],"tags":[],"acf":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"post-thumbnail":false},"uagb_author_info":{"display_name":"JunkHack","author_link":"https:\/\/hack.gpl.jp\/author\/junkhack\/"},"uagb_comment_info":0,"uagb_excerpt":"\u5148\u65e5\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u56f0\u3063\u3066\u3044\u307e\u3057\u305f\u3002 Termux\u306eapache2+php+mariadb\u306e\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u524d\u306ewo…","_links":{"self":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/posts\/5929"}],"collection":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/comments?post=5929"}],"version-history":[{"count":0,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/posts\/5929\/revisions"}],"wp:attachment":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/media?parent=5929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/categories?post=5929"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/tags?post=5929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}