{"id":31528,"date":"2025-04-14T12:41:01","date_gmt":"2025-04-14T04:41:01","guid":{"rendered":"https:\/\/jdssl.top\/?p=31528"},"modified":"2025-04-15T12:17:03","modified_gmt":"2025-04-15T04:17:03","slug":"n8n-ngrok","status":"publish","type":"post","link":"https:\/\/jdssl.top\/index.php\/2025\/04\/14\/n8n-ngrok\/","title":{"rendered":"\u672c\u5730\u670d\u52a1\u5668\u90e8\u7f72\u81ea\u52a8\u5316\u5de5\u5177n8n +ngrok\u4e00\u952e\u5b88\u62a4\u5b9e\u73b0https \u89e3\u9501\u6240\u6709\u529f\u80fd"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"31528\" class=\"elementor elementor-31528\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-425175d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"425175d\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-83c5606\" data-id=\"83c5606\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5658353 elementor-widget elementor-widget-text-editor\" data-id=\"5658353\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p data-pm-slice=\"1 2 []\">\u9002\u5408\u65b0\u624b\u5c0f\u767d\u5165\u95e8\uff0c\u6240\u6709\u6b65\u9aa4\u4f9d\u6b21\u6267\u884c\u5373\u53ef\u5b8c\u6210 n8n \u57fa\u7840\u73af\u5883\u3001\u90e8\u7f72\u3001HTTPS \u901a\u4fe1\u914d\u7f6e\u3001ngrok \u81ea\u52a8\u5316\u66f4\u65b0\u7ba1\u7406\u3002<\/p><div><hr \/><\/div><h4>\u4e00\u3001\u57fa\u7840\u73af\u5883\u914d\u7f6e (Ubuntu Server)<\/h4><h5>1.1 \u66f4\u65b0\u7cfb\u7edf<\/h5><pre><code>sudo apt update &amp;&amp; sudo apt upgrade -y<\/code><\/pre><h5>1.2 \u5b89\u88c5 Docker + docker-compose<\/h5><pre><code>sudo apt install -y docker.io docker-compose unzip curl jq\nsudo systemctl enable docker --now<\/code><\/pre><h5>1.3 \u9a8c\u8bc1\u662f\u5426\u5b89\u88c5\u6210\u529f<\/h5><pre><code>docker --version\ndocker-compose --version<\/code><\/pre><div><hr \/><\/div><h4>\u4e8c\u3001\u90e8\u7f72 n8n (Docker \u7248)<\/h4><h5>2.1 \u521b\u5efa\u76ee\u5f55<\/h5><pre><code>mkdir -p \/root\/n8n &amp;&amp; cd \/root\/n8n<\/code><\/pre><h5>2.2 \u7f16\u8f91 docker-compose.yml<\/h5><pre><code>nano docker-compose.yml<\/code><\/pre><p>\u5185\u5bb9\u586b\u5199:<\/p><pre><code>version: \"3.7\"\nservices:\n  n8n:\n    image: n8nio\/n8n\n    restart: always\n    ports:\n      - \"5678:5678\"\n    environment:\n      - N8N_BASIC_AUTH_ACTIVE=true\n      - N8N_BASIC_AUTH_USER=admin\n      - N8N_BASIC_AUTH_PASSWORD=yourpassword\n      - N8N_HOST=localhost\n      - N8N_PORT=5678\n      - WEBHOOK_URL=https:\/\/placeholder.ngrok-free.app\n      - WEBHOOK_TUNNEL_URL=https:\/\/placeholder.ngrok-free.app\n      - TZ=Asia\/Shanghai\n    volumes:\n      - \/root\/n8n\/n8n_data:\/home\/node\/.n8n<\/code><\/pre><blockquote><p>\u8bf7\u628a <code>yourpassword<\/code> \u6362\u6210\u4f60\u81ea\u5df1\u8bbe\u7f6e\u7684\u5bc6\u7801<\/p><\/blockquote><h5>2.3 \u542f\u52a8 n8n<\/h5><pre><code>cd \/root\/n8n\ndocker-compose up -d<\/code><\/pre><h5>2.4 \u6b63\u5e38\u542f\u52a8\u540e\uff0c\u8bbf\u95ee\u5730\u5740\uff1a<\/h5><pre><code>http:\/\/&lt;Ubuntu IP&gt;:5678<\/code><\/pre><p>\u8f93\u5165\u4f60\u7684 admin \u8d26\u53f7\u5bc6\u7801\u767b\u9646\u3002<\/p><div><hr \/><\/div><h5>\u4e09\u3001\u5b89\u88c5 ngrok \u5b9e\u73b0 HTTPS<\/h5><h5>3.1 \u4e0b\u8f7d ngrok<\/h5><pre><code>wget https:\/\/bin.equinox.io\/c\/bNyj1mQVY4c\/ngrok-stable-linux-amd64.zip -O ngrok.zip\nunzip ngrok.zip\nmv ngrok \/usr\/local\/bin\/\nchmod +x \/usr\/local\/bin\/ngrok<\/code><\/pre><h5>3.2 \u6ce8\u518c\u5e76\u8bbf\u95ee dashboard<\/h5><ul data-spread=\"false\"><li><p>\u8fce\u8fdb\u6b64\u7f51\u7ad9: <a>https:\/\/dashboard.ngrok.com\/get-started\/setup<\/a><\/p><\/li><li><p>\u521b\u5efa\u4e2a\u4eba\u8d26\u53f7<\/p><\/li><li><p>\u5907\u4efd authtoken<\/p><\/li><\/ul><h5>3.3 \u914d\u7f6e token<\/h5><pre><code>ngrok config add-authtoken &lt;\u5907\u4efd\u4f60\u7684 token&gt;<\/code><\/pre><h5>3.4 \u542f\u52a8 ngrok \u7ba1\u9053 (http)<\/h5><pre><code>ngrok http 5678 &gt; \/root\/ngrok.log 2&gt;&amp;1 &amp;<\/code><\/pre><div><hr \/><\/div><h4>\u56db\u3001\u67e5\u770b\u5f53\u524d ngrok URL<\/h4><h5>4.1 \u663e\u793a ngrok URL \u7684\u547d\u4ee4<\/h5><pre><code>curl -s http:\/\/127.0.0.1:4040\/api\/tunnels | grep -o 'https:\/\/[a-zA-Z0-9.-]*.ngrok-free.app' | head -n 1<\/code><\/pre><h5>4.2 \u5c06\u547d\u4ee4\u7b80\u5316\u6210 ngrok-url<\/h5><pre><code>echo 'curl -s http:\/\/127.0.0.1:4040\/api\/tunnels | grep -o \"https:\/\/[a-zA-Z0-9.-]*.ngrok-free.app\" | head -n 1' &gt; \/usr\/local\/bin\/ngrok-url\nchmod +x \/usr\/local\/bin\/ngrok-url<\/code><\/pre><p>\u65e2\u53ef:<\/p><pre><code>ngrok-url<\/code><\/pre><div><hr \/><\/div><h4>\u4e94\u3001\u81ea\u52a8\u66f4\u6362 ngrok \u5730\u5740\u811a\u672c + \u91cd\u542f n8n<\/h4><h5>5.1 \u65b0\u5efa\u811a\u672c \/root\/n8n\/update_ngrok_and_restart.sh<\/h5><pre><code>nano \/root\/n8n\/update_ngrok_and_restart.sh<\/code><\/pre><p>\u586b\u5165:<\/p><pre><code>#!\/bin\/bash\nset -e\nCOMPOSE_FILE=\"\/root\/n8n\/docker-compose.yml\"\nNGROK_API=\"http:\/\/127.0.0.1:4040\/api\/tunnels\"\n\nNGROK_URL=$(curl -s $NGROK_API | grep -o 'https:\/\/[a-zA-Z0-9.-]*.ngrok-free.app' | head -n 1)\n\nif [[ -z \"$NGROK_URL\" ]]; then\n  echo \"\\ud83d\\udeab \\u65e0\\u6cd5\\u83b7\\u53d6 ngrok \\u5730\\u5740\"\n  exit 1\nfi\n\necho \"\\u2705 \\u5f53\\u524d ngrok \\u5730\\u5740\uff1a$NGROK_URL\"\n\nsed -i \"s|WEBHOOK_TUNNEL_URL=.*|WEBHOOK_TUNNEL_URL=$NGROK_URL|\" \"$COMPOSE_FILE\"\nsed -i \"s|WEBHOOK_URL=.*|WEBHOOK_URL=$NGROK_URL|\" \"$COMPOSE_FILE\"\n\ncd \/root\/n8n\ndocker-compose down\ndocker-compose up -d\n\necho \"\\ud83c\\udf89 n8n \\u91cd\\u542f\\u5b8c\\u6210\uff0cngrok \u5730\\u5740\u5df2\u66f4\u65b0\\uff01\"<\/code><\/pre><h5>5.2 \u8bbe\u7f6e\u6743\u9650 + \u6267\u884c<\/h5><pre><code>chmod +x \/root\/n8n\/update_ngrok_and_restart.sh\n\/root\/n8n\/update_ngrok_and_restart.sh<\/code><\/pre><div><hr \/><\/div><h4>\u516d\u3001\u4e00\u952e\u5b8c\u6574\u64cd\u4f5c\u6d41\u7a0b<\/h4><pre><code>cd \/root\/n8n\nnohup ngrok http 5678 &gt; \/root\/ngrok.log 2&gt;&amp;1 &amp;\nsleep 2\n\/root\/n8n\/update_ngrok_and_restart.sh<\/code><\/pre><blockquote><p>\u8fd9\u6837\u4f1a\u81ea\u52a8\u83b7\u53d6 ngrok HTTPS \u5730\u5740\uff0c\u5e76\u66ff\u6362\u5230 docker-compose.yml \u91cc\u9762\uff0c\u91cd\u542f n8n<\/p><\/blockquote>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>\u9002\u5408\u65b0\u624b\u5c0f\u767d\u5165\u95e8\uff0c\u6240\u6709\u6b65\u9aa4\u4f9d\u6b21\u6267\u884c\u5373\u53ef\u5b8c\u6210 n8n \u57fa\u7840\u73af\u5883\u3001\u90e8\u7f72\u3001HTTPS \u901a\u4fe1\u914d\u7f6e\u3001ngrok \u81ea\u52a8\u5316\u66f4 &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/jdssl.top\/index.php\/2025\/04\/14\/n8n-ngrok\/\"> <span class=\"screen-reader-text\">\u672c\u5730\u670d\u52a1\u5668\u90e8\u7f72\u81ea\u52a8\u5316\u5de5\u5177n8n +ngrok\u4e00\u952e\u5b88\u62a4\u5b9e\u73b0https \u89e3\u9501\u6240\u6709\u529f\u80fd<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":76,"featured_media":31530,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"_uag_custom_page_level_css":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-31528","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-suoyoufenlei"],"uagb_featured_image_src":{"full":["https:\/\/jdssl.top\/wp-content\/uploads\/2025\/04\/\u672a\u6807\u9898-1.jpg",1920,1080,false],"thumbnail":["https:\/\/jdssl.top\/wp-content\/uploads\/2025\/04\/\u672a\u6807\u9898-1-150x150.jpg",150,150,true],"medium":["https:\/\/jdssl.top\/wp-content\/uploads\/2025\/04\/\u672a\u6807\u9898-1-300x169.jpg",300,169,true],"medium_large":["https:\/\/jdssl.top\/wp-content\/uploads\/2025\/04\/\u672a\u6807\u9898-1-768x432.jpg",768,432,true],"large":["https:\/\/jdssl.top\/wp-content\/uploads\/2025\/04\/\u672a\u6807\u9898-1-1024x576.jpg",1024,576,true],"1536x1536":["https:\/\/jdssl.top\/wp-content\/uploads\/2025\/04\/\u672a\u6807\u9898-1-1536x864.jpg",1536,864,true],"2048x2048":["https:\/\/jdssl.top\/wp-content\/uploads\/2025\/04\/\u672a\u6807\u9898-1.jpg",1920,1080,false]},"uagb_author_info":{"display_name":"jdssl","author_link":"https:\/\/jdssl.top\/index.php\/author\/jdssl\/"},"uagb_comment_info":3,"uagb_excerpt":"\u9002\u5408\u65b0\u624b\u5c0f\u767d\u5165\u95e8\uff0c\u6240\u6709\u6b65\u9aa4\u4f9d\u6b21\u6267\u884c\u5373\u53ef\u5b8c\u6210 n8n \u57fa\u7840\u73af\u5883\u3001\u90e8\u7f72\u3001HTTPS \u901a\u4fe1\u914d\u7f6e\u3001ngrok \u81ea\u52a8\u5316\u66f4&hellip;","_links":{"self":[{"href":"https:\/\/jdssl.top\/index.php\/wp-json\/wp\/v2\/posts\/31528","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdssl.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdssl.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdssl.top\/index.php\/wp-json\/wp\/v2\/users\/76"}],"replies":[{"embeddable":true,"href":"https:\/\/jdssl.top\/index.php\/wp-json\/wp\/v2\/comments?post=31528"}],"version-history":[{"count":13,"href":"https:\/\/jdssl.top\/index.php\/wp-json\/wp\/v2\/posts\/31528\/revisions"}],"predecessor-version":[{"id":31543,"href":"https:\/\/jdssl.top\/index.php\/wp-json\/wp\/v2\/posts\/31528\/revisions\/31543"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/jdssl.top\/index.php\/wp-json\/wp\/v2\/media\/31530"}],"wp:attachment":[{"href":"https:\/\/jdssl.top\/index.php\/wp-json\/wp\/v2\/media?parent=31528"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdssl.top\/index.php\/wp-json\/wp\/v2\/categories?post=31528"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdssl.top\/index.php\/wp-json\/wp\/v2\/tags?post=31528"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}