## AWS PORXXX Nginx & TOMCAT 연동
- 포탈 관리시스템 URL (http://3.XX.XX.XXX:8080)
1. nginx 설치
- $sudo apt-get install nginx
- $sudo nginx -v
nginx version: nginx/1.18.0 (Ubuntu)
- $sudo service nginx start
2. nginx와 tomcat 서버 연동
- 이 웹서버의 설정파일은 /etc/nginx/nginx.conf 파일에서 내용 추가
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
61 upstream portal {
62 server portal.koaXXX.ga: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 portal 파일 편집
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
server {
listen 80;
listen [::]:80;
server_name portal.koaXXX.ga;
# server_name 3.37.33.xxx; (IP주소로도 접속을 허용하려면 작성)
# root /var/www/example.com;
# index index.html;
location / {
proxy_pass http://portal;
proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
charset utf-8;
index index.jsp;
# try_files $uri $uri/ =404; (넣으면 NGINX 에러 발생)
}
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- /sites-enables/ 로 가서 default 심볼릭링크 삭제
- root@ip-10-20-18-211:/etc/nginx/sites-enabled# rm -rf default
- sudo ln -s ../sites-available/portal portal (심볼릭링크 재설정)
- root@ip-10-20-18-211:/etc/nginx/sites-enabled# nginx -t (OK사인 확인)
- nginx 재시작
: sudo nginx -s reload
- nginx (80) 포트를 이용하여 -> tomcat (8080) 서버로 접속 가능
'NGINX' 카테고리의 다른 글
[실습 성공] 무료 SSL 인증서 & HTTPS 구성 (0) | 2021.05.31 |
---|---|
[에러] HTTPS 인증서 발행시... (0) | 2021.05.31 |
Nginx에 HTTPS SSL 적용하기 (0) | 2021.05.28 |
[실습 성공] 무료 SSL 인증서를 받고 HTTPS를 구성하는 방법 (How to get free SSL certificate and configure HTTPS) (0) | 2021.05.26 |
[학습] NGINX 상세구조 분석 (0) | 2021.05.21 |
댓글