nginx 는 같은 도 메 인 이름 을 뒤의 주소 에 따라 다른 항목 을 할당 하도록 설정 합 니 다.

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
  worker_connections 1024;
}

http {
  include mime.types;
  default_type application/octet-stream;

  #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 logs/access.log main;

  sendfile on;
  #tcp_nopush on;

  #keepalive_timeout 0;
  keepalive_timeout 65;

  #gzip on;

  # another virtual host using mix of IP-, name-, and port-based configuration

  #        ,    
server {
  listen 80;
  server_name abc.com;

  location ~ /(js|css|font|img) {
     root D:\\efwork\\weinxin\\staticResource\\OfficialAccount;

  }

//                     
  location ^~/ctl/{
  proxy_pass http://localhost:12100;

  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header Host $host;
  proxy_pass_request_headers on;
  proxy_pass_request_body on;
  proxy_intercept_errors on;
  }
//                     
location ^~/oac/{
  proxy_pass http://localhost:10101;

  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header Host $host;
  proxy_pass_request_headers on;
  proxy_pass_request_body on;
  proxy_intercept_errors on;
  }

}

}

        403
    , nginx.conf    user nobody   user root

좋은 웹페이지 즐겨찾기