본문 바로가기
TOMCAT

Nginx 설치 및 설정

by SAMSUNG CLOUD-OKY 2020. 12. 21.
반응형

  1-2) ## Nginx 설치 (https://blog.yeon.me/goto/569)    (https://hyojun123.github.io/2018/05/30/linux1/) (2020-12-21)

       1. nginx 설치

         - $sudo apt-get install nginx

         - $sudo service nginx start

 

       2. nginx tomcat 서버 연동

         - 이 웹서버의 설정파일은  /etc/nginx/nginx.conf 파일에서 내용 추가

       <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

         61         upstream tomcat {

         62             server 127.0.0.1:8080;

         63         }

         64

         66         include /etc/nginx/conf.d/*.conf;

         67         include /etc/nginx/sites-enabled/*;

       >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

 

         - cd sites-available/ 디렉토리로 이동

         - root@ip-10-20-18-211:/etc/nginx/sites-available# cd sites-available/

         - vi opendedx 파일 생성

         <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

         server {

                 location / {

                     proxy_set_header    HOST $host;

                     proxy_set_header    X-Real-IP $remote_addr;

                     proxy_set_header    X-Forwarded-For $remote_addr;

 

                     proxy_pass http://127.0.0.1:8080;

                     proxy_redirect  off;

                     charset utf-8;

 

                     index index.jsp;

                 }

         }

         >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

 

         - /sites-enables/ 로 가서 default 심볼릭링크 삭제

         - root@ip-10-20-18-211:/etc/nginx/sites-enabled# rm -rf default

         - sudo ln -s ../sites-available/openedx openedx      (심볼릭링크 재설정)

         - root@ip-10-20-18-211:/etc/nginx/sites-enabled# nginx -t   (OK사인 확인)

         - nginx 재시작

           : sudo nginx -s reload

         - nginx (80) 포트를 이용하여 -> tomcat (8080) 서버로 접속 가능

 

 

 

 

 

반응형

댓글