created by aha00a at 2014-04-25
last modified by aha00a at 2021-02-22
revision: 11

1. Rewrite

rewrite ^(.*) $scheme://$host$1 permanent;

1.1. example - Rewriting http://aha00a.kr/something to http://aha00a.com/something.

server
{
    server_name aha00a.kr;
    rewrite ^(.*) $scheme://aha00a.com$1 permanent;
}

1.2. example - Rewriting http://aha00a.com/something to https://aha00a.com/something.

server
{
        listen  80;
        server_name aha00a.com;
        rewrite ^(.*) https://$host$1 permanent;
}

2. Load Balancing

upstream localhost_upstream {
        server localhost:10001;
        server localhost:10002;
}

server {
        location / {
                proxy_pass http://localhost_upstream/;
        }
}

3. .conf

server {
    client_max_body_size 20M;
}

4. access.log

cat access.log | grep "GET /some/path/" | perl -pe 's{^.* \[([^]]+)\] "GET /some/path/([\S]+).*$}{$1\t$2}g'

5. Troubleshootings

5.1. Dump Config From Running Process

식겁했다..

https://serverfault.com/questions/361421/dump-nginx-config-from-running-process

gdb를 이용해서 메모리 dump해서 문자열 검색으로 찾아서 복원할 수 있음.

--2021-02-22

5.2. Load balancing on Windows

Windows에서 load balancing이 안되는 문제가 있는데, 아래 설정을 넣어주면 해결됨. --2017-08-11

    proxy_connect_timeout 2s;

7. See Also

7.2. Similar Pages

Similar pages by cosine similarity. Words after page name are term frequency.

  • 35.90% Aha00a aha00a(11:22), kr(3:1), name(2:1), 있음(1:1)
  • 33.66% aha00a.com aha00a(11:26), from(3:1), web(1:1)
  • 32.70% RecentChanges aha00a(11:3652), name(2:180), from(3:90), windows(2:24), web(1:18), server(8:6), kr(3:6), something(8:1), perl(1:6), nginx(5:2)
  • 32.39% PageList aha00a(11:3652), from(3:90), windows(2:24), web(1:18), server(8:6), kr(3:6), something(8:1), perl(1:6), nginx(5:2), load(5:2)
  • 32.35% ApacheRewrite aha00a(11:6), rewrite(5:7), server(8:2), kr(3:6), rewriting(4:2), some(2:4), location(1:4), web(1:2)
  • 30.82% AhaDiffHelper aha00a(11:10), kr(3:10), log(3:2)

7.3. Adjacent Pages