網站首頁 編程語言 正文
周日領導說docker nginx起不來了,導致jira域名映射失敗,記錄一下解決過程
操作
首先nginx不是自己部署,要先啟動一下
docker start nginx
發現打印出了nginx 但是 docker ps 發現 nginx還是啟動失敗
于是準備查看日志
docker logs -f nginx
報了一堆錯誤,也不知道是什么時候打的日志,后來解決之后猜測是因為配置文件為空的原因,因為沒有找到event模塊
所以首先看一下nginx的容器信息
docker inspect nginx
找到掛載信息了,可以看看配置文件,發現 /usr/nginx/conf 里面沒有配置文件,這個時候就應該找到了問題;可是運維同學在查詢問題的時候創建了一個空的nginx.conf,我沒有打開配置文件
后來在老大的提醒下打開了配置文件發現是空的,然后就對配置文件進行了修改
先找了一個默認的nginx.conf的配置
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { # proxy the PHP scripts to Apache listening on 127.0.0.1:80 #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; # deny access to .htaccess files, if Apache's document root # concurs with nginx's one #location ~ /\.ht { # deny all; } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on;
然后docker start nginx 發現可以啟動了
接下來增加正確的jira配置
location / { proxy_pass http://192.168.1.111:8080; proxy_redirect off; proxy_set_header Host $host:$server_port; ##重點在$server_port proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_max_temp_file_size 0; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_hide_header Vary; proxy_set_header Accept-Encoding ''; proxy_set_header Referer $http_referer; proxy_set_header Cookie $http_cookie; }
進入容器檢測一下配置文件是否有問題
docker exec -it 容器id /bin/bash
nginx路徑尋找 find / -name nginx
./nginx/sbin/nginx -t
檢測發現少了一個}
:set nu
找到具體行,然后修復
ctrl +D // 退出容器
啟動nginx
docker restart nginx
結果
雖然解決的很慢 但是還是解決了問題,nginx單點也是有問題的,后期打算切換到多活的nginx,然后備份相關nginx文件
原文鏈接:https://blog.csdn.net/yujing1314/article/details/122919722
相關推薦
- 2021-12-09 Jenkins+GitLab+Docker持續集成LNMP
- 2022-11-25 詳解Python中的數據精度問題_python
- 2023-06-19 阿里低代碼框架lowcode-engine設置默認容器詳解_React
- 2022-04-18 Python讀取配置文件-ConfigParser的二次封裝方法_python
- 2022-10-16 解析React?ref?命令代替父子組件的數據傳遞問題_React
- 2022-06-15 C#實現冒泡排序和插入排序算法_C#教程
- 2022-09-20 C#?Winform實現進度條顯示_C#教程
- 2022-06-29 Oracle遞歸查詢connect?by用法_oracle
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支