Nginx Proxy_pass 설정 ( url 유지 )

문학적인유사성·2023년 1월 5일
0

misc.

목록 보기
13/31

프록시로는 가게 만들고싶은데, url은 유지하고 싶어 !!!!!

공식문서0
공식문서1
스택오버플로우0

However, if this field is not present in a client request header then nothing will be passed. In such a case it is better to use the $host variable - its value equals the server name in the “Host” request header field or the primary server name if this field is not present:

proxy_set_header Host       $host;

conf.d 밑에다가 넣을 것
location / {} 추가
설정은 공식문서 참조하면 설명이 나와있더라... 굿!

server {
    listen 443;
    server_name domain_name;
    
    ssl on;
    ssl_certificate path/crt;
    ssl_certificate_key path/key; 
    
    ssl_session_cache	shared:SSL:1m;
    ssl_session_timeout 5m;
    ssl_ciphers HIGH:MEDIUM:!SSLv2:!PSK:!SRP:!ADH:!AECDH;
    ssl_prefer_server_ciphers	on;
    
    location / {
    	proxy_pass target_server_name;
        proxy_http_version 1.1;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Prot $server_port;
    }
    
    error_page 500 502 504 504 /50x.html;
    
    ...
    
}
    
profile
Are you nervous? Don't be

0개의 댓글