관리 메뉴

IT.FARMER

ASW Ubunt Nginx Tomcat 연동 설정 Ubunt 본문

Web Server, WAS/Nginx

ASW Ubunt Nginx Tomcat 연동 설정 Ubunt

아이티.파머 2016. 6. 30. 15:13
반응형

Nginx Tomcat 설치 이후.


nginx.conf 환경설정을 참조하도록 되어 있다.

$sudo vim /etc/nginx/nginx.conf  에서 

...

include conf.d/*conf

#include sites-enable *  // 주석처리 , 읽지 않도록 

...


# Tomcat정보 파일을 생성한다.  proxy pass 설정 

$sudo vim /etc/nginx/conf.d/tomcat.conf


upstream tomcat {

        ip_hash;
        server 127.0.0.1:8080;
}

server { 
     listen 80;
     #listen 443 ssl;
     #root  /home/skan/server......

     server_name localhost;
     #access_log /home/skan/server/log/nginx/tomcat_access.log;

     location / {
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $http_host;
         
          proxy_pass http://tomcat;
          proxy_redirect off;
          charset utf-8;
     }

         #static mappling
         #location /images/ {
         #      alias /home/application/static/.......
         # }
         
}


nginx configuration에 이상이 없는지 확인
$sudo nginx -t 

서비스 정보 리로드 

$sudo nginx -s reload
혹은 서버 리스타트

$sudo service nginx restart





접속후 Nginx 웰컴페이지가 아닌 Tomcat ROOT 디렉토리의 index.jsp 파일이보이면 성공

AWS도 OS자체가 Ubunt 이다보니 별다른 설정은 없다.

단지 콘솔창에 인바운드 아웃바운드만 좀 설정해주면 되니 더편리한듯.



반응형

'Web Server, WAS > Nginx' 카테고리의 다른 글

Nginx Upstream keepalive  (0) 2020.05.26
nginx tomcat vitual host 설정  (0) 2017.07.06