Skip to content

领导又让我在centos8离线安装nginx,该怎么办

About 1082 wordsAbout 4 min

2024-10-12

这一次是比较具有挑战性的任务。

因为是在一个离线的服务器上面装相关的运行服务,一些底层的库都需要自己找,然后自己安装。

这次需要安装的软件有nginx、docker服务(不会安装的小伙伴可以看我另外一篇文章,Centos8离线安装Docker

一、安装Nginx

1.1、安装perl

Pcre安装

1.4 参考文章

Centos 8安装gcc的方法

Centos离线安装gcc-c++,make, nginx

1.5、包下载地址

centos RPM 包下载地址

RPM resource /usr/bin/pkg-config

1.6 报错

1.6.1、pcre问题

没有安装,或者是安装了,但是找不到问题。

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

二、安装docker

Centos8离线安装Docker

在网站上面下载软件,然后安装,出现了下面的问题:

WARN[2024-10-14T15:28:09.053129829Z] grpc: addrConn.createTransport failed to connect to {unix:///var/run/docker/containerd/containerd.sock  <nil> 0 <nil>}. Err :connection error: desc = "transport: Error while dialing dial unix:///var/run/docker/containerd/containerd.sock: timeout". Reconnecting...  module=grpc
failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: iptables v1.8.5 (nf_tables): Could not fetch rule set generation id: Permission denied (you must be root)

docker运行nginx容器

docker run --name nginx -p 9481:9481 -p 9581:9581 -v /etc/nginx:/etc/nginx -v /home/cmes/project/nginx:/home/cmes/project/nginx -itd nginx

三、检查软件是否安装成功

检查Linux系统是否安装了gcc,pcre,zlib,openssl

四、运行Java docker 容器

docker run --name identity_resolution_java -p 8481:8481 -v /home/cmes/project/backend:/usr/src/identity-resolution -itd identity_resolution_pro

curl -H "Content-Type:application/json" -X POST -d '{"handleId": 370}' "http://xx.xxx.188.153:8481/handle/selectHandleItemMap"

curl -H "Content-Type:application/json" -X POST -d '{"handleId": 370}' "http://127.0.0.1:8481/handle/selectHandleItemMap"

400 Request Header Or Cookie Too Large

curl -H "Content-Type:application/json" -X POST -d '{"handleId": 370}' "http://xx.xxx.188.153:9481/api/handle/selectHandleItemMap"

因为是放到容器里面, 在代理后端服务的时候要用容器的ip

报错:connect() failed (111: Connection refused) while connecting to upstream

Nginx报502错误,日志connect() failed (111: Connection refused) while connecting to upstream的个人有效解决方案

400 Bad Request Request Header Or Cookie Too Large

nginx 报 502 bad gateway 分析解决

nginx file

(base) ➜ bssyyyglpt-main (main) ✗ git fetch --all
remote: The project you were looking for could not be found or you don't have permission to view it.
fatal: repository 'https://xx.xxx.18.224/alicloud/bssyyyglpt.git/' not found

Git clone http://用户名@125.01.02.03:10086/test/xiangmu.git(输入密码后即拉取代码成功)

Changelog

Last Updated: 3/27/25, 4:13 PMView All Changelog
  • feat(wiki): hammeSpoon: 复制出来的文件需要重新生成永链

    On 3/27/25

求求了,快滚去学习!!!

求求了求求了,快去学习吧!

【题单】贪心算法

不知道方向的时候,可以多看看书,书会给你指明下一步该干什么,加油!