日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

http通道连接mysql_通过http tunnel连接mysql

發(fā)布時間:2025/3/15 数据库 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 http通道连接mysql_通过http tunnel连接mysql 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

在/etc/nginx/nginx.conf的第一行加上

load_module /usr/lib64/nginx/modules/ngx_http_proxy_connect_module.so;

nginx -s reload

> ```nginx: [emerg] dlopen() "/usr/lib64/nginx/modules/ngx_http_proxy_connect_module.so" failed (/usr/lib64/nginx/modules/ngx_http_proxy_connect_module.so: cannot open shared object file: No such file or directory) in /etc/nginx/nginx.conf```

又要開始折騰了, 沒有ngx_http_proxy_connect_module, google了一把, ngx_http_proxy_connect_module

相當(dāng)于重新編譯nginx, 有幾個坑, 不過意外發(fā)現(xiàn)有個go的開源庫,專門編譯nginx,剛好我是go開發(fā),go的庫nginx-build, 但是下面說的跟這個庫沒關(guān)系, 只是打個go的廣告^_^

(1) 選定對應(yīng)的nginx源碼zip,更改nginx的version, nginx -v

(2) ./configure的編譯參數(shù), 需要提前nginx -V復(fù)制之前的啟動參數(shù)下來

(3) 執(zhí)行path的時候需要看`https://github.com/chobits/ngx_http_proxy_connect_module`的說明,哪個版本用哪個patch

$ git clone https://github.com/chobits/ngx_http_proxy_connect_module.git /root/ngx_http_proxy_connect_module

$ wget http://nginx.org/download/nginx-1.12.2.tar.gz

$ tar -xzvf nginx-1.12.2.tar.gz

$ cd nginx-1.12.2/

$ patch -p1 < /root/ngx_http_proxy_connect_module/patch/proxy_connect.patch

$ ./configure --add-module=/root/ngx_http_proxy_connect_module ·后面接上nginx -V里面的configure arguments·

$ make && make install

$ cp /root/ngx_http_proxy_connect_module

執(zhí)行過程

$ ./configure --add-dynamic-module=/root/ngx_http_proxy_connect_module --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_auth_request_module --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'

出現(xiàn)各種錯誤,各種google,最終

yum -y install redhat-rpm-config.noarch

yum -y install libxslt-devel

yum -y install perl-devel perl-ExtUtils-Embed

yum -y install gd-devel

yum -y install geoip-devel

yum -y install gperftools-devel

最后編譯只出現(xiàn)warning類的報錯才算成功

+ using system PCRE library

+ using system OpenSSL library

+ using system zlib library

nginx path prefix: "/usr/share/nginx"

nginx binary file: "/usr/sbin/nginx"

nginx modules path: "/usr/lib64/nginx/modules"

nginx configuration prefix: "/etc/nginx"

nginx configuration file: "/etc/nginx/nginx.conf"

nginx pid file: "/run/nginx.pid"

nginx error log file: "/var/log/nginx/error.log"

nginx http access log file: "/var/log/nginx/access.log"

nginx http client request body temporary files: "/var/lib/nginx/tmp/client_body"

nginx http proxy temporary files: "/var/lib/nginx/tmp/proxy"

nginx http fastcgi temporary files: "/var/lib/nginx/tmp/fastcgi"

nginx http uwsgi temporary files: "/var/lib/nginx/tmp/uwsgi"

nginx http scgi temporary files: "/var/lib/nginx/tmp/scgi"

./configure: warning: the "--with-ipv6" option is deprecated

ls /usr/lib64/nginx/modules 就會發(fā)現(xiàn)ngx_http_proxy_connect_module.so文件已經(jīng)生成了, /usr/lib64/nginx/modules是modules路徑, nginx -V可以看到–modules-path

開始配置nginx

stream {

server {

listen 443;

server_name t1.test.example.com;

proxy_connect;

proxy_connect_allow 443;

proxy_connect_connect_timeout 10s;

proxy_connect_read_timeout 10s;

proxy_connect_send_timeout 10s;

proxy_pass http://$http_host;

}

}

尷尬的發(fā)現(xiàn)到這里又做下不去了,只能轉(zhuǎn)發(fā)http的流量,無法利用http的tunnel改為tcp流量,到此結(jié)束

總結(jié)

以上是生活随笔為你收集整理的http通道连接mysql_通过http tunnel连接mysql的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。