nginx启动失败如何解决
发表于:2024-10-04 作者:千家信息网编辑
千家信息网最后更新 2024年10月04日,这篇文章主要介绍了nginx启动失败如何解决的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇nginx启动失败如何解决文章都会有所收获,下面我们一起来看看吧。操作首先ngi
千家信息网最后更新 2024年10月04日nginx启动失败如何解决
这篇文章主要介绍了nginx启动失败如何解决的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇nginx启动失败如何解决文章都会有所收获,下面我们一起来看看吧。
操作
首先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启动失败如何解决"知识都有一定的了解,大家如果还想学习更多知识,欢迎关注行业资讯频道。
配置
文件
容器
时候
知识
问题
信息
内容
日志
篇文章
检测
接下来
价值
原因
同学
操作简单
文章
易懂
更多
模块
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
三级的网络技术的语言
数据库管理艺术
境外服务器色情
服务器日常运行管理制度执行
信息技术数据库英文
消费结构数据库
推理机将综合数据库
博雅数据库河北省2020
网络安全你我他书信作文400字
税控服务器管理系统客服电话
软件开发-请选思恒
中山服务器在哪里买
搞游戏软件开发丢人么
白日门怎么连不上数据库
华为 网络安全产品
多媒体对数据库的影响
软件开发考研哪个学校好
杭州领奇互联网科技
软件开发个人绩效总结
光遇土豆服务器下载
网络安全培训视频教程下载
深云sdp客户端连不上服务器
荒野乱斗延迟服务器
重庆服务器机柜厂家虚拟主机
最便宜服务器租用
深圳市众脉共赢网络技术
WiFi模块连接数据库
网络技术职业培训学校
创新是网络安全
苏州欧瑞思丹网络技术