NGINX - Default Web Server

  • Web Server 용으로 기본 구성 수행

Prepare - Lab File Upload

  • Lab Files
    • 첨부파일 활용
    • /opt/services/ 내 Unzip


Web Service Config

  • /etc/nginx/conf.d/web.conf

        sub_filter_once off;
        sub_filter 'server_hostname' '$hostname';
        sub_filter 'server_address'  '$server_addr:$server_port';
        sub_filter 'server_url'      '$request_uri';
        sub_filter 'remote_addr'     '$remote_addr:$remote_port';
        sub_filter 'server_date'     '$time_local';
        sub_filter 'client_browser'  '$http_user_agent';
        sub_filter 'request_id'      '$request_id';
        sub_filter 'nginx_version'   '$nginx_version';
        sub_filter 'document_root'   '$document_root';
        sub_filter 'proxied_for_ip'  '$http_x_forwarded_for';
    
    server {    
        listen       9001;
        index  index.html;
       
        location / {
        root   /opt/services/App1;
        }
    }
    server {
        listen       9002;
        index  index.html;
    
       location / {
        root   /opt/services/App2;
        }
    }
    server {
        listen       9003;
        index  index.html;
    
        location / {
        root   /opt/services/App3;
        }
    }
    

Web Service - Check

  • nginx -s reload
  • curl IP:9001 ~ 9003