profile image

L o a d i n g . . .

Proxy 란?

- 정보를 대신 전달해주는 주체

- Proxy Server라고 하면 중계 서버가 됨

- 프록시 없이 웹 서버를 운영할 경우, 사용자가 갑자기 많아질 때 처리가 느리고, 웹 서버가 그대로 노출되어 있어서 보안적으로 위험성이 있음

- Nginx를 사용하면 로드 밸런싱으로 부하를 줄일 수 있고, 분산 처리 또한 가능하며, 웹 서버의 SSL 인증도 적용 가능함

- 사용자 → Nginx → 웹서버로 구성해서 사용자의 요청을 Nginx가 대신 웹서버로 전달하도록 함


Reverse Proxy 란?

- 클라이언트의 요청을 대신 받아 내부 서버로 전달해주는 것

# /etc/nginx/sites-available/프로젝트이름.conf 에 설정할 것

server {
  listen 80;
  server_name localhost;
  location / {
    root   /home/build;
    index  index.html index.htm;
    try_files $uri $uri/ /index.html;
  }
}
{
  "name": "fe",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "4.0.3",
    "web-vitals": "^1.0.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "proxy": "http://localhost:8080/", # CROS 문제 해결
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

참고

1. https://narup.tistory.com/238

2. https://sundries-in-myidea.tistory.com/125

복사했습니다!