{"id":379,"date":"2026-01-26T07:42:30","date_gmt":"2026-01-26T07:42:30","guid":{"rendered":"https:\/\/blog.gpst.net.cn:4008\/?p=379"},"modified":"2026-01-28T06:24:13","modified_gmt":"2026-01-28T06:24:13","slug":"openresty%e8%bf%90%e7%bb%b4-%e6%97%a5%e5%bf%97%e8%ae%b0%e5%bd%95%e8%af%b7%e6%b1%82%e4%bd%93%e5%92%8c%e5%93%8d%e5%ba%94%e4%bd%93%e5%86%85%e5%ae%b9","status":"publish","type":"post","link":"https:\/\/opshub.com.cn\/?p=379","title":{"rendered":"openresty\u8fd0\u7ef4\u2014\u2014\u65e5\u5fd7\u8bb0\u5f55\u8bf7\u6c42\u4f53\u548c\u54cd\u5e94\u4f53\u5185\u5bb9"},"content":{"rendered":"\n<p>\u7814\u7a76\u6210\u679c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>I\u3001\u6d88\u606f\u4f53\u89e3\u7801\n\n\n\n\nII\u3001\u8ba9\u957f\u6d88\u606f\u4f53\u663e\u793a\u5b8c\u6574<\/code><\/pre>\n\n\n\n<p>\u4e00\u3001\u5b89\u88c5openresty<\/p>\n\n\n\n<p>1\u3001\u4e0b\u8f7d\u94fe\u63a5\uff1a<a href=\"https:\/\/openresty.org\/download\/openresty-1.19.9.2.tar.gz\">https:\/\/openresty.org\/download\/openresty-1.19.9.2.tar.gz<\/a><\/p>\n\n\n\n<p>2\u3001\u7834\u89e3\u00a0\u65e5\u5fd7\u6d88\u606f\u786c\u7f16\u7801\u957f\u5ea6\u9650\u5236<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sed -i '\/^#define NGX_MAX_ERROR_STR\/s\/4096\/1024000\/g' .\/bundle\/nginx-1.19.9\/src\/core\/ngx_log.h .\/build\/nginx-1.19.9\/src\/core\/ngx_log.h<\/code><\/pre>\n\n\n\n<p>3\u3001\u5b89\u88c5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yum install pcre-devel openssl-devel gcc curl zlib-devel\n.\/configure --prefix=\/usr\/local\/openresty -j2\ngmake -j2\ngmake install<\/code><\/pre>\n\n\n\n<p>\u4e8c\u3001\u914d\u7f6eopenresty<\/p>\n\n\n\n<p>1\u3001nginx.conf:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>worker_processes  1;\nevents {\n    worker_connections  10240;\n}\nhttp {\n    include       mime.types;\n    default_type  application\/octet-stream;\n    log_format main escape=json '{\"realip\":\"$remote_addr\",\"timestamp\":\"$time_iso8601\",\"request\":\"$request\",\"content_type\":\"$sent_http_content_type\",\"content_disposition\":\"$sent_http_content_disposition\",\"referer\":\"$http_referer\",\"user_agent\":\"$http_user_agent\",\"req_body_size\":\"$content_length\",\"req_body\":\"$request_body\",\"status\":\"$status\",\"resp_body_size\":\"$body_bytes_sent\",\"resp_body\":\"$resp_body\"}';\n                        \n    lua_package_path \"\/usr\/local\/openresty\/lualib\/?.lua;;\";\n    lua_package_cpath \"\/usr\/local\/openresty\/lualib\/?.so;;\";\n    access_log  logs\/access.log  main;\n    sendfile        on;\n    keepalive_timeout  65;\n    include vhosts\/*.conf;\n}<\/code><\/pre>\n\n\n\n<p>2\u3001clcs-front.conf:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\n    listen 9993;\n    root \/data\/qianduan\/CLCS-front\/dist;\n    charset utf-8;\n    include \/etc\/nginx\/default.d\/*.conf;\n    error_page 404 \/404.html;\n    location = \/404.html {\n    }\n    error_page 500 502 503 504 \/50x.html;\n    set $resp_body \"\";\n    lua_need_request_body on;\n    body_filter_by_lua '\n    local resp_body = string.sub(ngx.arg&#091;1], 1, 1024000)\n    ngx.ctx.buffered = (ngx.ctx.buffered or \"\") .. resp_body\n    if ngx.arg&#091;2] then\n    ngx.var.resp_body = ngx.ctx.buffered\n    end\n    ';\n    location = \/50x.html {\n    }\n    location \/ {\n        root \/data\/qianduan\/CLCS-front\/dist;\n        index index.html index.htm;\n        try_files $uri $uri\/ \/index.html;\n        error_page 405 =200 $request_uri;\n    }\n    location \/api\/ {\n        proxy_http_version 1.1;\n        rewrite ^\/api\/(.*)$ \/$1 break;\n        proxy_pass http:\/\/192.168.1.51:18085;\n        proxy_read_timeout 1800s;\n        client_max_body_size 10m;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n    }\n    location \/fileApi\/ {\n        proxy_http_version 1.1;\n        rewrite ^\/fileApi\/(.*)$ \/$1 break;\n        proxy_pass http:\/\/118.31.4.241:11509;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n    }\n    location \/ws {\n        proxy_pass http:\/\/118.31.4.241:11503; # WebSocket \u540e\u7aef\u5730\u5740\n        proxy_http_version 1.1; # \u4f7f\u7528 HTTP\/1.1 \u4ee5\u652f\u6301 WebSocket\n        proxy_set_header Upgrade $http_upgrade; # \u5fc5\u987b\u8bbe\u7f6e Upgrade \u5934\n        proxy_set_header Connection \"upgrade\"; # \u5fc5\u987b\u8bbe\u7f6e Connection \u5934\n        proxy_set_header Host $host; # \u4f20\u9012 Host \u4fe1\u606f\n        proxy_set_header X-Real-IP $remote_addr; # \u4f20\u9012\u5ba2\u6237\u7aef IP\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # \u4f20\u9012\u5ba2\u6237\u7aef\u94fe\u8def\n        proxy_set_header X-Forwarded-Proto $scheme; # \u4f20\u9012\u534f\u8bae (http\/https)\n        proxy_read_timeout 3600s;\n        proxy_send_timeout 3600s;\n    }\n    location ~ \/\\.ht {\n        deny all;\n    }\n    access_log \/var\/log\/CLCS-front-1.log main;\n    error_log \/var\/log\/CLCS-front-1.err.log;\n}<\/code><\/pre>\n\n\n\n<p>\u4e09\u3001\u5b89\u88c5gotty:<\/p>\n\n\n\n<p>1\u3001\u4e0b\u8f7d:<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/yudai\/gotty\/releases\/download\/v1.0.1\/gotty_linux_amd64.tar.gz\">https:\/\/github.com\/yudai\/gotty\/releases\/download\/v1.0.1\/gotty_linux_amd64.tar.gz<\/a><\/p>\n\n\n\n<p>2\u3001\u5b89\u88c5jq:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yum -y install jq<\/code><\/pre>\n\n\n\n<p>3\u3001\u542f\u52a8\u670d\u52a1:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nohup \/usr\/local\/openresty\/bin\/gotty -p 8888 -c root:szhl@2019 sh -c 'tail -n 3 -f \/var\/log\/CLCS-front-1.log  |jq' &amp;&gt;\/dev\/null &amp;<\/code><\/pre>\n\n\n\n<p>\u6548\u679c\u5c55\u793a\uff1a<\/p>\n\n\n\n<p>\u52fe\u9009\u5355\u8bcd\u67e5\u8be2100\u6761\/\u9875\uff0c\u65e5\u5fd7\u4e2d\u7684\u6d88\u606f\u4f53\u663e\u793a\u5b8c\u6574\uff0c\u4e0d\u622a\u65ad\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"469\" src=\"https:\/\/blog.opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-54-1024x469.png\" alt=\"\" class=\"wp-image-381\" srcset=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-54-1024x469.png 1024w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-54-300x137.png 300w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-54-768x351.png 768w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-54-1536x703.png 1536w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-54.png 1606w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"353\" src=\"https:\/\/blog.opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-55-1024x353.png\" alt=\"\" class=\"wp-image-382\" srcset=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-55-1024x353.png 1024w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-55-300x103.png 300w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-55-768x265.png 768w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-55-1536x529.png 1536w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-55.png 1889w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u8bf7\u6c42\u4f53\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"29\" src=\"https:\/\/blog.opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-56-1024x29.png\" alt=\"\" class=\"wp-image-383\" srcset=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-56-1024x29.png 1024w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-56-300x9.png 300w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-56-768x22.png 768w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-56-1536x44.png 1536w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-56.png 1887w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u54cd\u5e94\u4f53\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"435\" src=\"https:\/\/blog.opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-57-1024x435.png\" alt=\"\" class=\"wp-image-384\" srcset=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-57-1024x435.png 1024w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-57-300x128.png 300w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-57-768x326.png 768w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-57-1536x653.png 1536w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-57.png 1887w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"518\" src=\"https:\/\/blog.opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-58-1024x518.png\" alt=\"\" class=\"wp-image-385\" srcset=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-58-1024x518.png 1024w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-58-300x152.png 300w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-58-768x388.png 768w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-58-1536x777.png 1536w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/Image-58.png 1882w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u7814\u7a76\u6210\u679c\uff1a \u4e00\u3001\u5b89\u88c5openresty 1\u3001\u4e0b\u8f7d\u94fe\u63a5\uff1ahttps:\/\/openresty.org\/download\/openresty-1.19.9.2.tar.gz 2\u3001\u7834\u89e3\u00a0\u65e5\u5fd7\u6d88\u606f\u786c\u7f16\u7801\u957f\u5ea6\u9650\u5236 3\u3001\u5b89\u88c5 \u4e8c\u3001\u914d\u7f6eopenresty 1\u3001nginx.conf: 2\u3001clcs-front.conf: \u4e09\u3001\u5b89\u88c5gotty: 1\u3001\u4e0b\u8f7d: https:\/\/github.com\/yudai\/gotty\/releases\/download\/v1.0.1\/gotty_linux_amd64.tar.gz 2\u3001\u5b89\u88c5jq: 3\u3001\u542f\u52a8\u670d\u52a1: \u6548\u679c\u5c55\u793a\uff1a \u52fe\u9009\u5355\u8bcd\u67e5\u8be2100\u6761\/\u9875\uff0c\u65e5\u5fd7\u4e2d\u7684\u6d88\u606f\u4f53\u663e\u793a\u5b8c\u6574\uff0c\u4e0d\u622a\u65ad\uff1a \u8bf7\u6c42\u4f53\uff1a \u54cd\u5e94\u4f53\uff1a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-379","post","type-post","status-publish","format-standard","hentry","category-9"],"_links":{"self":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=379"}],"version-history":[{"count":4,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/379\/revisions"}],"predecessor-version":[{"id":623,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/379\/revisions\/623"}],"wp:attachment":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=379"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=379"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}