반응형

'메모 메모' 카테고리의 다른 글

술 맛 보기  (0) 2024.03.25
돈을 내는 서비스는  (1) 2024.03.20
보드게임 카페의 불편함 점.  (0) 2024.03.03
VSCode sudo로 debugging 하기  (0) 2024.02.29
nginx cache header struct  (0) 2024.02.29

launch.json 을 다음과 같이 설정하면, debug console 창이 아닌, terminal 창에서 디버깅이 시작된다.

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Launch Package",
      "type": "go",
      "request": "launch",
      "mode": "auto",
      "program": "${workspaceFolder}/main.go",
      "console": "integratedTerminal",
      "asRoot": true
    }
  ]
}

sudo password를 물으면, 입력하고 진행하자.

"console": "integratedTerminal",
"asRoot": true

두개의 옵션이 중요하다.

반응형

nginx 소스 중 일부

typedef struct {
    ngx_uint_t                       version;
    time_t                           valid_sec;
    time_t                           updating_sec;
    time_t                           error_sec;
    time_t                           last_modified;
    time_t                           date;
    uint32_t                         crc32;
    u_short                          valid_msec;
    u_short                          header_start;
    u_short                          body_start;
    u_char                           etag_len;
    u_char                           etag[NGX_HTTP_CACHE_ETAG_LEN];
    u_char                           vary_len;
    u_char                           vary[NGX_HTTP_CACHE_VARY_LEN];
    u_char                           variant[NGX_HTTP_CACHE_KEY_LEN];
} ngx_http_file_cache_header_t;

캐시 파일 중

head -n 1 CACHE_FILE | xxd
00000000: 0500 0000 0000 0000 75dd de65 0000 0000  ........u..e....
00000010: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000020: c746 9a64 0000 0000 65cf de65 0000 0000  .F.d....e..e....
00000030: 14fb f249 0000 7001 6502 1322 3634 3961  ...I..p.e.."649a
00000040: 3436 6337 2d35 6236 6166 3030 3422 0000  46c7-5b6af004"..
00000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000060: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000070: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000080: 0000 0000 0000 0000 0000 0000 0000 0000  ................

분석을 더 해봐야겠지만,

  • 1열 0-3 합쳐서 version (0500 0000 0000 0000)
  • 1열 4-7 합쳐서 valid_sec (75dd de65 0000 0000)

이렇게 분석 가능할 것으로 추측된다.

반응형

nginx 1.25.1의 change log 살펴보니

Changes with nginx 1.25.1                                        13 Jun 2023
    *) Feature: the "http2" directive, which enables HTTP/2 on a per-server
       basis; the "http2" parameter of the "listen" directive is now
       deprecated.
    *) Change: HTTP/2 server push support has been removed.
    *) Change: the deprecated "ssl" directive is not supported anymore.
    *) Bugfix: in HTTP/3 when using OpenSSL.

http2 에 대해서 설정하는 방법이 달라졌고, per-server 단위 설정이 가능하다고 한다.


확인해보자.

기존의 설정인

server {
  listen 443 ssl http2;
  ssl_certificate server.crt;  
  ssl_certificate_key server.key;  
}

에서

server {  
    listen 443 ssl;  
    http2 on;  
    ssl_certificate server.crt;  
    ssl_certificate_key server.key;  
}

으로 변경 됐다.

nginx 1.24.0

server {
  server_name http2test.mingky.me;
  listen 80;
  listen 443 ssl http2;
  ssl_certificate server.crt;
  ssl_certificate_key server.key;
  location / {
    return 200;
  }
}
server {
  server_name http2test2.mingky.me;
  listen 80;
  listen 443 ssl;
  ssl_certificate server.crt;
  ssl_certificate_key server.key;
  location / {   
    return 200;
  }
}

curl 확인

curl https://http2test.mingky.me -I
HTTP/2 200 
server: nginx/1.24.0
date: Wed, 28 Feb 2024 08:33:39 GMT
content-type: application/octet-stream
content-length: 0

curl https://http2test2.mingky.me -I
HTTP/2 200 
server: nginx/1.24.0
date: Wed, 28 Feb 2024 08:33:42 GMT
content-type: application/octet-stream
content-length: 0

설정을 하지 않아도 http2로 연결되는 것을 확인 할 수 있다.

nginx 1.25.4

server {
  server_name http2test.mingky.me;
  listen 80;
  listen 443 ssl;
  http2 on;
  ssl_certificate server.crt;
  ssl_certificate_key server.key;
  location / {
    return 200;
  }
}
server {
  server_name http2test2.mingky.me;
  listen 80;
  listen 443 ssl;
  ssl_certificate server.crt;
  ssl_certificate_key server.key;
  location / {
    return 200;
  }
}

curl 확인

curl https://http2test.mingky.me -I 
HTTP/2 200 
server: nginx/1.25.4
date: Wed, 28 Feb 2024 08:42:03 GMT
content-type: application/octet-stream
content-length: 0

curl https://http2test2.mingky.me -I
HTTP/1.1 200 OK
Server: nginx/1.25.4
Date: Wed, 28 Feb 2024 08:42:05 GMT
Content-Type: application/octet-stream
Content-Length: 0
Connection: keep-alive
반응형

'메모 메모' 카테고리의 다른 글

돈을 내는 서비스는  (1) 2024.03.20
nginx SSL 인증서를 plain text로 넣는 방법  (0) 2024.03.08
보드게임 카페의 불편함 점.  (0) 2024.03.03
VSCode sudo로 debugging 하기  (0) 2024.02.29
nginx cache header struct  (0) 2024.02.29

+ Recent posts