Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NGINX Reverse Proxy #126

Open
hyunnnn98 opened this issue Oct 1, 2023 · 1 comment
Open

NGINX Reverse Proxy #126

hyunnnn98 opened this issue Oct 1, 2023 · 1 comment
Assignees
Labels
💻 dev 🔋 environment New feature or request

Comments

@hyunnnn98
Copy link
Collaborator

변경 내용

이렇게 Nginx 설정 파일을 업데이트하려 합니다.

이슈 내용

현재 Nginx 설정 파일에는 Next.js 및 Nest.js 애플리케이션을 프록시하는 설정이 포함되어 있습니다. 이 설정은 80번 포트에서 웹 애플리케이션을 제공하고, WebSocket 연결도 관리합니다.

변경 내용

이 설정에서 주요 변경 사항은 다음과 같습니다:

  1. server_name을 실제 도메인 이름 또는 호스트 이름으로 변경하세요.
  2. location /api/scrum-dicelocation /socket.ioproxy_pass 주소를 애플리케이션의 실제 주소로 변경하세요.
  3. 필요한 경우 SSL 설정을 추가하여 보안을 강화하세요.

새로운 설정 파일:

# 새로운 Nginx 설정 파일

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    keepalive_timeout   65;
    types_hash_max_size 4096;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    include /etc/nginx/conf.d/*.conf;

    map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
    }

    upstream websocket {
        server 127.0.0.1:8080;
    }

    server {
        listen 80;
        server_name your_domain.com;  # 도메인 이름 또는 호스트 이름으로 변경

        location / {
            proxy_pass http://127.0.0.1:3000; # Next.js 애플리케이션의 주소로 변경
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }

        location /api/scrum-dice {
            proxy_pass http://127.0.0.1:8080; # Nest.js HTTP 애플리케이션의 주소로 변경
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }

        location /socket.io {
            proxy_pass http://websocket;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
            proxy_set_header Host $host;
        }

        location /scrum-dice {
            proxy_pass http://websocket;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
            proxy_set_header Host $host;
        }
    }
}
@hyunnnn98
Copy link
Collaborator Author

hyunnnn98 commented Oct 1, 2023

Todo: @Samsam-lee

  • Route53 설정 ( + domain 구매 )
  • nginx config 에 생성한 domain 을 server_name 에 적용하기.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 dev 🔋 environment New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants