elastic beanstalk의 기본 nginx 설정들

2023. 12. 14. 13:37·프로그래밍 언어 및 기타/공통

빡쳐서 임시로 만들어 ec2 접속 후 들여다봤다.

 

nginx.conf

#Elastic Beanstalk Nginx Configuration File

user                    nginx;
error_log               /var/log/nginx/error.log warn;
pid                     /var/run/nginx.pid;
worker_processes        auto;
worker_rlimit_nofile    200000;

events {
    worker_connections  1024;
}

http {
    server_tokens off;
    
    include       /etc/nginx/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"';

    include       conf.d/*.conf;

    map $http_upgrade $connection_upgrade {
        default     "upgrade";
    }

    server {
        listen        80 default_server;
        access_log    /var/log/nginx/access.log main;

        client_header_timeout 60;
        client_body_timeout   60;
        keepalive_timeout     60;
        gzip                  off;
        gzip_comp_level       4;
        gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;

        # Include the Elastic Beanstalk generated locations
        include conf.d/elasticbeanstalk/*.conf;
    }
    }

 

nginx.conf.default

#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;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

 

 

 

location / {
    proxy_pass          http://127.0.0.1:5000;
    proxy_http_version  1.1;

    proxy_set_header    Connection          $connection_upgrade;
    proxy_set_header    Upgrade             $http_upgrade;
    proxy_set_header    Host                $host;
    proxy_set_header    X-Real-IP           $remote_addr;
    proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
}

if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})T(\d{2})") {
    set $year $1;
    set $month $2;
    set $day $3;
    set $hour $4;
}

 

log_format healthd  '$msec"$uri"'
                    '$status"$request_time"$upstream_response_time"'
                    '$http_x_forwarded_for';

'프로그래밍 언어 및 기타 > 공통' 카테고리의 다른 글

쿠버네티스 입문 책 읽고 생각 정리  (0) 2024.07.27
electron-vue 앱 만들기  (0) 2022.04.05
나도 주석을 잘 쓰자.  (0) 2021.08.19
'프로그래밍 언어 및 기타/공통' 카테고리의 다른 글
  • 쿠버네티스 입문 책 읽고 생각 정리
  • electron-vue 앱 만들기
  • 나도 주석을 잘 쓰자.
용나리
용나리
  • 용나리
    티스토리 블로그
    용나리
  • 전체
    오늘
    어제
    • 분류 전체보기 (334)
      • 과거의 것들 (93)
        • AI Tech boostcamp (92)
      • 생각정리(고찰) (2)
      • 기술 글 (1)
      • 코딩테스트 (4)
        • C++ (0)
        • Python (4)
      • CS (121)
        • 컴퓨터 시스템 (4)
        • 코틀린 인 액션 (13)
        • 김영한 스프링 강의 (104)
      • 일지 남기기용 (11)
        • 운동 (10)
      • 개발 배포 해보기 (1)
      • 프로그래밍 언어 및 기타 (32)
        • Spring Boot (9)
        • Python (9)
        • Kotlin (1)
        • Flutter (2)
        • SQL (4)
        • Docker (3)
        • 공통 (4)
      • os (4)
        • Linux (4)
      • 기술 (17)
        • PyTorch (6)
        • Computer Vision (6)
        • NLP (1)
        • 기타 (4)
      • 제품 후기 (0)
      • 게임 (0)
        • Human Resource Machine (0)
      • 강의 (26)
        • fullstackdeeplearning_sprin.. (9)
        • 부캠 안드로이드 학습정리 (17)
      • 개인 메모 (10)
      • IT 기타 (5)
      • 논문 읽기 연습 (5)
        • Computer Vision (1)
        • NLP (0)
        • 공통 (2)
        • 그냥 메모 (2)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    pip install killed
    파이썬 실행경로
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.5
용나리
elastic beanstalk의 기본 nginx 설정들
상단으로

티스토리툴바