nginx -t "nginx: [warn] only the last index in "index" directive should be absolute in 6 "的问题解决...

本文介绍了一次解决Nginx配置文件中出现的警告信息的过程。通过添加缺失的分号解决了nginx:[warn]onlythelastindexinindexdirective...警告,并提供了完整的配置示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 修改完nginx的配置文件之后,执行nginx -t命令提示"nginx: [warn] only the last index in "index" directive should be absolute in 6 "

相关代码段为:   

 1 server
 2 {
 3       listen                   80;
 4       server_name              www.web1.com;
 5       index                    index.jsp index.html index.htm
 6       access_log               /export/servers/nginx/logs/www.web1.com/access.log main;
 7       error_log                /export/servers/nginx/logs/www.web1.com/error.log warn;
 8       #chunkin on;
 9       error_page 411 = @my_error;
10       location @my_error {
11              #chunkin_resume;
12       }
13       root /export/data/tomcatRoot/www.web1.com/;
14 
15 
16       location / {
17          proxy_next_upstream     http_500 http_502 http_503 http_504 error timeout invalid_header;
18          proxy_set_header        Host  $host;
19          proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
20          proxy_pass              http://tomcat_web1;
21          expires                 1d;
22       }
23       location /logs/ {
24                 autoindex       off;
25                 deny all;
26       }
27 
28 }

发现问题没? 原来是第5行少了一个;号...

填上,解决...

转载于:https://www.cnblogs.com/onmyway20xx/p/3664187.html

root@iZ2ze3qhya9blvlx5gep84Z:/home/nginx-power# docker logs --tail 20 4daa /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates. sh /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes. sh /docker-entrypoint.sh: Configuration complete; ready for start up nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directi ve in /etc/nginx/conf.d/default.conf:2 /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perf orm configuration /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-defa ult.sh 10-listen-on-ipv6-by-default.sh: info: can not modify /etc/nginx/conf.d/default .conf (read-only file system?) /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates. sh /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes. sh /docker-entrypoint.sh: Configuration complete; ready for start up nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directi ve in /etc/nginx/conf.d/default.conf:2 /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perf orm configuration /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-defa ult.sh 10-listen-on-ipv6-by-default.sh: info: can not modify /etc/nginx/conf.d/default .conf (read-only file system?) /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates. sh /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes. sh /docker-entrypoint.sh: Configuration complete; ready for start up nginx: [warn] conflicting server name "localhost" on 0.0.0.0:9007, ignored
最新发布
08-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值