Reverse Proxy(nginx)

Reverse Proxy(nginx)

NginX 설치

공식DOC

# yum-utils 설치 sudo yum install yum-utils # yum repository 설정 vim /etc/yum.repos.d/nginx.repo [nginx-stable] name=nginx stable repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true [nginx-mainline] name=nginx mainline repo baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/ gpgcheck=1 enabled=0 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true # update sudo yum-config-manager --enable nginx-mainline # 설치 sudo yum install nginx -y # 시작 프로그램 등록 및 시작 systemctl enable nginx systemctl start nginx

 

서버 설정

https://confluence.atlassian.com/jirakb/configure-jira-to-run-behind-a-nginx-reverse-proxy-426115340.html

nginx 설정

# nginx 설정 vim /etc/nginx/conf.d/lavence-test.com.conf server { listen 80; server_name lavence-test.com; location /jira { proxy_pass http://10.220.0.60:8080/jira; 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 http; } location /confluence { proxy_pass http://10.220.0.60:8090/confluence; 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 http; } location /crowd { proxy_pass http://10.220.0.60:8095/crowd; 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 http; } } # nginx 재시작 systemctl restart nginx

Jira/confluence 설정

vi /opt/jira/conf/server,xml (confluence도 경로 동일) # service 내에서 # DEFAULT - Direct connector with no proxy for unproxied access to Jira. <- 주석처리 # HTTP - Proxying Jira via Apache or Nginx over HTTP <- 주석 해제 # AJP - Proxying Jira via Apache over HTTP or HTTPS <- HOST 설정 수정 # Context path="" 를 Context path="/jira"로 수정 <Context path="/jira" docBase="${catalina.home}/atlassian-jira" reloadable="false" useHttpOnly="true">

crowd 설정

vi crowd/apache-tomcat/conf/server.xml # Engine 내에서 # <appBase="webapps" autoDeploy="true" Host name="localhost" unpackWARs="true"> 밑에 Context 넣어주기 <Context path="/crowd" docBase="${catalina.home}/../crowd-webapp" reloadable="false" useHttpOnly="true" />

 

hosts에 ip 및 호스트 추가

windows hosts 파일 경로: C:\Windows\System32\drivers\etc

hosts에서 하단에 추가

(관리자 권한이 필요하기 때문에 hosts 파일을 복사해서 다른 곳에서 수정하고 붙여넣는 방식을 추천)

10.220.0.60 lavence-test.com

 

WebUI에서 BaseURL 설정하기

접속 시 다음과 같은 에러 메시지가 발생

image-20250403-065014.png

설정(톱니바퀴) > General Config/System에서 서버 기본 URL 주소 설정

하단은 confluence의 예시

image-20250403-065225.png

 

트러블슈팅 - 502가 발생하는 경우

방화벽 문제일 수 있기 때문에 selinux와 firewalld를 내리고 진행

 

Looking for labels? They can now be found in the details panel on the floating action bar.

Related content