Merge branch 'main' of https://demo.stam.kr/leejisun9/bio_backend
This commit is contained in:
		@@ -1,46 +1,49 @@
 | 
			
		||||
# ./nginx/nginx.conf
 | 
			
		||||
 | 
			
		||||
# 이벤트 블록은 Nginx가 어떻게 연결을 처리할지 정의합니다.
 | 
			
		||||
events {
 | 
			
		||||
    worker_connections 1024;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# HTTP 블록은 웹 서버의 동작을 정의합니다.
 | 
			
		||||
http {
 | 
			
		||||
    # MIME 타입 파일을 포함하여 파일 확장자에 따라 콘텐츠 타입을 결정합니다.
 | 
			
		||||
 | 
			
		||||
    include mime.types;
 | 
			
		||||
    error_log logs/error.log warn;
 | 
			
		||||
    default_type application/octet-stream;
 | 
			
		||||
    sendfile on;
 | 
			
		||||
    keepalive_timeout 65;
 | 
			
		||||
 | 
			
		||||
     # <<< 여기서 log_format 'main'을 정의 >>>
 | 
			
		||||
    log_format main '$remote_addr - $remote_user [$time_local] "$request" '
 | 
			
		||||
                    '$status $body_bytes_sent "$http_referer" '
 | 
			
		||||
                    '"$http_user_agent" "$http_x_forwarded_for"';
 | 
			
		||||
    # 위에서 정의한 'main'을 사용
 | 
			
		||||
    access_log logs/access.log main;
 | 
			
		||||
    # (선택) 로그 위치
 | 
			
		||||
    access_log logs/access.log;
 | 
			
		||||
    error_log  logs/error.log warn;
 | 
			
		||||
 | 
			
		||||
    # 웹소켓용
 | 
			
		||||
    map $http_upgrade $connection_upgrade {
 | 
			
		||||
        default upgrade;
 | 
			
		||||
        ''      close;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # 기본 서버 설정을 정의합니다.
 | 
			
		||||
    server {
 | 
			
		||||
        # 80번 포트에서 요청을 받습니다.
 | 
			
		||||
        listen 80;
 | 
			
		||||
        server_name localhost; # 서버 이름을 localhost로 설정
 | 
			
		||||
        server_name localhost;
 | 
			
		||||
 | 
			
		||||
        # 루트 경로(/)로 들어오는 모든 요청을 처리합니다.
 | 
			
		||||
        # Nuxt(개발서버 3000)
 | 
			
		||||
        location / {
 | 
			
		||||
            # 요청을 다른 서버(여기서는 Nuxt.js)로 전달합니다.
 | 
			
		||||
            proxy_pass http://localhost:3000;
 | 
			
		||||
            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_http_version 1.1;
 | 
			
		||||
            proxy_set_header Upgrade $http_upgrade;
 | 
			
		||||
            proxy_set_header Connection $connection_upgrade;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
            # 프록시 헤더를 설정하여 원본 요청 정보를 유지합니다.
 | 
			
		||||
        # Spring Boot(8080) — /service 접두어 제거
 | 
			
		||||
        location /service/ {
 | 
			
		||||
            proxy_pass http://localhost:8080;  # 끝에 슬래시 넣으면 /service가 제거됨
 | 
			
		||||
            proxy_set_header Host $host;
 | 
			
		||||
            proxy_set_header X-Real-IP $remote_addr;
 | 
			
		||||
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        # /api/ 경로로 들어오는 요청을 처리합니다. (Spring Boot 컨테이너를 가리킨다고 가정)
 | 
			
		||||
        location /service {
 | 
			
		||||
            proxy_pass http://localhost:8080;
 | 
			
		||||
            proxy_set_header Host $host;
 | 
			
		||||
            proxy_set_header X-Real-IP $remote_addr;
 | 
			
		||||
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 | 
			
		||||
        }
 | 
			
		||||
        # (선택) 업로드 크게 받을 때
 | 
			
		||||
        # client_max_body_size 50m;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user