콘텐츠로 건너뛰기
Home » 블로그 » nginx reverse proxy 설정 예제

nginx reverse proxy 설정 예제

server {

  listen       80;
  listen       [::]:80;
  server_name  {도메인};
  root         /usr/share/nginx/html;

  index index.php index.html;
  location / {
    try_files $uri $uri/ @nodejs;
  }

  location @nodejs {
    add_header author "{TeraWebServer}";
    proxy_redirect off;
    proxy_http_version 1.1;
    proxy_pass http://127.0.0.1:1337;
    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 10M;

  # hide server info
  server_tokens off;

  # Protect XSS Attack
  add_header X-XSS-Protection "1; mode=block";

  location ~ /\.ht {
    deny all;
  }

}