摘要:運營研發(fā)團隊張仕華配置系列頭不合法頭重復參考如上配置訪問需要認證將設置為不可讀使用非方法訪問一個靜態(tài)文件系列修改為缺少引號語法錯誤的現(xiàn)在只支持如果客戶端隨意設置這個值會報修改配置為指向一
運營研發(fā)團隊 張仕華
nginx配置worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; sendfile on; keepalive_timeout 65; server { listen 8070; server_name 10.96.79.14; limit_req zone=one; location / { root html; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location = /abc.html { root html; auth_basic "opened site"; auth_basic_user_file conf/htpasswd; } location ~ .php$ { root /home/xiaoju/nginx-1.14.0/html; fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME /home/xiaoju/nginx-1.14.0/html$fastcgi_script_name; include fastcgi.conf; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; } } }
index.php
4xx系列 400NGX_HTTP_BAD_REQUEST
Host頭不合法 curl localhost:8070 -H "Host:123/com"401400 Bad Request 400 Bad Request
nginx/1.14.0 Content-Length頭重復 curl localhost:8070 -H "Content-Length:1" -H "Content-Length:2"400 Bad Request 400 Bad Request
nginx/1.14.0 NGX_HTTP_UNAUTHORIZED
參考如上nginx配置,訪問abc.html需要認證 curl localhost:8070/abc.html403401 Authorization Required 401 Authorization Required
nginx/1.14.0 NGX_HTTP_FORBIDDEN
chmod 222 index.html 將index.html設置為不可讀 curl localhost:8070404403 Forbidden 403 Forbidden
nginx/1.14.0 NGX_HTTP_NOT_FOUND
curl localhost:8070/cde.html405404 Not Found 404 Not Found
nginx/1.14.0 NGX_HTTP_NOT_ALLOWED
使用非GET/POST/HEAD方法訪問一個靜態(tài)文件 curl -X DELETE localhost:8070/index.html -I HTTP/1.1 405 Not Allowed Server: nginx/1.14.0 Date: Tue, 18 Sep 2018 10:02:22 GMT Content-Type: text/html Content-Length: 173 Connection: keep-alive5xx系列 500NGX_HTTP_INTERNAL_SERVER_ERROR
修改index.php為
缺少引號,語法錯誤
curl localhost:8070/index.php -I HTTP/1.1 500 Internal Server Error Server: nginx/1.14.0 Date: Tue, 18 Sep 2018 11:29:19 GMT Content-Type: text/html; charset=UTF-8 Connection: keep-alive Set-Cookie: PHPSESSID=aoesvcuvbh1nh95kdkp152r9e1; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate Pragma: no-cache501NGX_HTTP_NOT_IMPLEMENTED
nginx的transfer-encoding現(xiàn)在只支持chunked,如果客戶端隨意設置這個值,會報501 curl localhost:8070 -H "Transfer-Encoding:1"502501 Not Implemented 501 Not Implemented
nginx/1.14.0 NGX_HTTP_BAD_GATEWAY
修改nginx配置為 fastcgi_pass 127.0.0.1:8000;指向一個未監(jiān)聽的端口
curl localhost:8070/index.php -I HTTP/1.1 502 Bad Gateway Server: nginx/1.14.0 Date: Tue, 18 Sep 2018 11:28:17 GMT Content-Type: text/html Content-Length: 537 Connection: keep-alive ETag: "5ad6113c-219"503NGX_HTTP_SERVICE_UNAVAILABLE
修改nginx配置,限速為每分鐘10個請求 limit_req_zone $binary_remote_addr zone=one:10m rate=10r/m; limit_req zone=one;連續(xù)發(fā)送兩個請求,第二請求會報503 curl localhost:8070/index.php -I HTTP/1.1 503 Service Temporarily Unavailable Server: nginx/1.14.0 Date: Tue, 18 Sep 2018 11:31:43 GMT Content-Type: text/html Content-Length: 537 Connection: keep-alive ETag: "5ad6113c-219"504NGX_HTTP_GATEWAY_TIME_OUT
修改index.php為
curl localhost:8070/index.php -I HTTP/1.1 504 Gateway Time-out Server: nginx/1.14.0 Date: Tue, 18 Sep 2018 12:17:57 GMT Content-Type: text/html Content-Length: 537 Connection: keep-alive ETag: "5ad6113c-219"505NGX_HTTP_VERSION_NOT_SUPPORTED
telnet8070端口,輸入GET /index.html HTTP/2.1 不支持http/2.1,會報505 $telnet localhost 8070 Trying 127.0.0.1... Connected to localhost. Escape character is "^]". GET /index.html HTTP/2.1 HTTP/1.1 505 HTTP Version Not Supported Server: nginx/1.14.0 Date: Tue, 18 Sep 2018 12:26:35 GMT Content-Type: text/html Content-Length: 203 Connection: close505 HTTP Version Not Supported 505 HTTP Version Not Supported
nginx/1.14.0 后續(xù)基于這幾種情況,看Nginx源碼內部是怎么實現(xiàn)的。
文章版權歸作者所有,未經(jīng)允許請勿轉載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉載請注明本文地址:http://www.ezyhdfw.cn/yun/40174.html
摘要:配置系列頭不合法頭重復參考如上配置訪問需要認證將設置為不可讀使用非方法訪問一個靜態(tài)文件系列修改為缺少引號語法錯誤的現(xiàn)在只支持如果客戶端隨意設置這個值會報修改配置為指向一個未監(jiān)聽的端口 nginx配置 worker_processes 1; events { worker_connections 1024; } http { include mime.ty...
摘要:目標后端任一接口一分鐘內響應超過一定的量,馬上收到報警提示報警及慢接口有詳細列表可以查看低成本。相關報警請求的詳細信息列表慢響應分析 目標 后端任一接口一分鐘內5xx響應超過一定的量,馬上收到報警提示 報警及慢接口有詳細列表可以查看 低成本。幾年前公司的日志報警系統(tǒng)是自研的,開發(fā)成本比較高,也沒有達到阿里云日志服務這種產(chǎn)品化程度 機器部署情況 阿里云EC服務器 功能概述 阿里云日...
序 本文主要講述一下nginx lua如何重置請求參數(shù)以及整理了幾類常量。 重置請求參數(shù) 獲取請求參數(shù) local strider = ngx.var.arg_strider local strider = ngx.req.get_uri_args[strider] 當請求uri中有多個同名參數(shù)時,ngx.var.arg_xx的做法是取第一個出現(xiàn)的值,ngx.req_get_uri_args[xx...
摘要:若用戶發(fā)起了一個條件請求,而資源近期未被修改,可以通過該狀態(tài)碼表明。將來的請求應該使用老的和狀態(tài)碼之間存在一些交叉。服務器擔心請求會引發(fā)沖突時,可以發(fā)送此狀態(tài)碼。 狀態(tài)碼 狀態(tài)碼是來告訴客戶端,發(fā)生了什么事情。狀態(tài)碼為客戶端提供了一種理解事務處理結果的便捷方式。狀態(tài)碼位于響應的起始行中 比如,在行 HTTP/1.0 200 OK 中,狀態(tài)碼就是200 客戶端向一個 HTTP 服務器發(fā)送...
閱讀 1721·2019-08-30 13:04
閱讀 2278·2019-08-30 12:59
閱讀 1845·2019-08-29 18:34
閱讀 1949·2019-08-29 17:31
閱讀 1346·2019-08-29 15:42
閱讀 3668·2019-08-29 15:37
閱讀 2956·2019-08-29 13:45
閱讀 2848·2019-08-26 13:57