一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務器之家:專注于服務器技術及軟件下載分享
分類導航

云服務器|WEB服務器|FTP服務器|郵件服務器|虛擬主機|服務器安全|DNS服務器|服務器知識|Nginx|IIS|Tomcat|

服務器之家 - 服務器技術 - Nginx - 記錄一次nginx啟動失敗的解決過程

記錄一次nginx啟動失敗的解決過程

2022-02-24 22:18漸暖° Nginx

小編最近遇到這樣一個問題docker nginx起不來了,導致jira域名映射失敗,如何解決呢?下面小編給大家分享下nginx啟動失敗的解決過程,感興趣的朋友一起看看吧

周日領導說docker nginx起不來了,導致jira域名映射失敗,記錄一下解決過程

操作

首先nginx不是自己部署,要先啟動一下

?
1
docker start nginx

記錄一次nginx啟動失敗的解決過程

發現打印出了nginx 但是 docker ps 發現 nginx還是啟動失敗

于是準備查看日志

?
1
docker logs -f nginx

記錄一次nginx啟動失敗的解決過程


報了一堆錯誤,也不知道是什么時候打的日志,后來解決之后猜測是因為配置文件為空的原因,因為沒有找到event模塊

所以首先看一下nginx的容器信息

?
1
docker inspect nginx

記錄一次nginx啟動失敗的解決過程


找到掛載信息了,可以看看配置文件,發現 /usr/nginx/conf 里面沒有配置文件,這個時候就應該找到了問題;可是運維同學在查詢問題的時候創建了一個空的nginx.conf,我沒有打開配置文件

后來在老大的提醒下打開了配置文件發現是空的,然后就對配置文件進行了修改

先找了一個默認的nginx.conf的配置

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#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配置

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
       }

進入容器檢測一下配置文件是否有問題

?
1
docker exec -it 容器id /bin/bash

nginx路徑尋找 find / -name nginx

?
1
./nginx/sbin/nginx -t

檢測發現少了一個}

?
1
:set nu

找到具體行,然后修復

?
1
ctrl +D  // 退出容器

啟動nginx

?
1
docker restart nginx

結果

雖然解決的很慢 但是還是解決了問題,nginx單點也是有問題的,后期打算切換到多活的nginx,然后備份相關nginx文件

到此這篇關于記錄一次nginx啟動失敗的解決過程的文章就介紹到這了,更多相關nginx啟動失敗內容請搜索服務器之家以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持服務器之家!

原文鏈接:https://blog.csdn.net/yujing1314/article/details/122919722

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 好逼365 | 波多洁野衣一二区三区 | 嫩草影院永久在线一二三四 | 国产精品第1页在线播放 | 国产亚洲精品美女久久久 | 91视频夜色 | 美女被躁爽死 | 精品丰满人妻无套内射 | 国产精品福利在线观看入口 | 亚洲欧美日韩国产精品影院 | 性bbbbwwbbbb| 3d动漫免费 | 欧美折磨另类系列sm | 动漫美女被吸乳羞羞小说 | 丝瓜视频看污片 | 欧美久久久久久久一区二区三区 | 国产成人精品系列在线观看 | 免费国产高清精品一区在线 | 国产精品免费网站 | 湿好紧太硬了我太爽了 | 色热综合 | 青青成人福利国产在线视频 | 亚洲成a人片777777久久 | 国产剧情一区 | 欧美一区二区三区精品影视 | 精品手机在线视频 | 女人又色又爽又黄 | 996免费视频国产在线播放 | 无码欧美喷潮福利XXXX | 国产欧美日韩在线不卡第一页 | 午夜精品久久久久久久2023 | 我被黄总征服的全过程 | 国内剧情麻豆 | 免费深夜福利 | 成人小视频在线观看 | 扒开黑女人p大荫蒂老女人 扒开大腿狠狠挺进视频 | 含羞草传媒网站免费进入欢迎 | 国产亚洲人成网站在线观看不卡 | 日韩亚洲欧美理论片 | 动漫人物差差差动漫人物免费观看 | 5g影院天天5g爽天天看 |