---
title: "Atlassian 어플리케이션 Reverse Proxy 구성 가이드 with Apache"
canonical: "https://wiki.kicco.com/space/AC/67010728/Atlassian%20%EC%96%B4%ED%94%8C%EB%A6%AC%EC%BC%80%EC%9D%B4%EC%85%98%20Reverse%20Proxy%20%EA%B5%AC%EC%84%B1%20%EA%B0%80%EC%9D%B4%EB%93%9C%20with%20Apache"
format: markdown
---
> Macro (toc)

## **개요**

---

 이 가이드는 Apache HTTP 서버가 Atlassian 서버 어플리케이션의 Reverse Proxy 역할을 하는 네트워크 토폴로지를 설정하는 방법에 대해 설명한다. 자체 도메인이나 다른 도메인의 하위 도메인, Context Path, 포트로 어플리케이션을 구분할 수 있다. 본 가이드에서는  Context path로 구분한다.

Context Path 설정 방법은 [Set a context path for Atlassian application](https://confluence.atlassian.com/kb/set-a-context-path-for-atlassian-applications-836601189.html)을 참고한다. 

### 시작 전 확인 사항

- Apache 버전 2.2 또는 2.4 설치(**confluence 6.0 버전 이상을 사용중**이라면 Debian과 Ubuntu는 2.4, 나머지는 2.4.10 버전 이상 필요) → [Apache 문서](http://httpd.apache.org/docs/current/)
- DNS entries in place and configured for your domains
- 설치 되고 접근 가능한 Atlassian Products

## **Reverse Proxy 구성**

---

### Atlassian 어플리케이션 구성

 이 부분에서는 각각의 Atlassian 어플리케이션에 있는 Tomcat(혹은 Jetty) 웹 서버를 reverse proxy에서 작동하도록 구성하는 방법에 대해 설명한다.

- Atlassian 어플리케이션 중지
- Context path 설정(crowd는 기본으로 context path 갖고있음)

커넥터 디렉티브(Connector directive) 구성

- <Jira, Confluence, Crowd>각각의 어플리케이션의 **<설치 디렉토리>/conf/server.xml** 파일(crowd는 /apache-tomcat/conf/server.xml)의 non-SSL 커넥터 디렉티브를 찾아서 주석해제 후 **scheme**, **proxyName**(ex kic.com) 그리고 **proxyPort** 항목을 아래와 같이 추가해야한다.
  **server.xml**
- <Bitbucket> **<Bitbucket 홈 디렉토리>/shared/bitbucket.properties** 내에 아래 내용을 추가한다.
  **bitbucket.properties**

### Apache HTTP 서버 구성

Apache의 mod_proxy를 활성화한다.

<details>
<summary>Debian/Ubuntu</summary>

Debian과 Ubuntu는 아파치를 'Apache2'라 칭하며, apache2.conf 파일은 **/etc/apache2** 디렉토리에 위치해있다. 아래 커맨드를 입력해 활성화 한다.

```shell
sudo a2enmod proxy_http
#Confluence 6.0 버전 이상을 Synchrony와 사용중이라면 Apache 2.4 버전을 사용해야하고, mod_proxy_wstunnel과 mod_rewrite 모듈도 활성화해야한다.
sudo a2enmod proxy_wstunnel
sudo a2enmod rewrite
```
</details>

<details>
<summary>Fedora/CentOS</summary>

Fedora와 CentOS 7은 아파치를 'httpd'라 칭하며 mod_proxy가 기본적으로 활성화 되어있다. 구성 파일 위치는 **/etc/httpd/conf/, /etc/httpd/conf.d/ **그리고** /etc/httpd/conf.modules.d/** 디렉토리에 위치해있다.

Confluence 6.0 버전 이상을 Synchrony와 사용중이라면** Apache 2.4.10 버전 이상**을 사용해야하고 **mod_proxy_wstunnel** 그리고** mod_rewrite** 모듈이 활성화 되어 있는지 확인해야한다.
</details>

<details>
<summary>Window</summary>

Window는 아파치를 'httpd'라 칭하며 **\conf\httpd.conf\**에 설정 파일이 위치해있다.

mod_proxy와 지원 모듈을 활성화하기 위해선 httpd.conf 파일 구성 중 아래 항목을 **주석 해제**(#지우기)하면 된다.

##### **httpd.conf**

```shell
LoadModule proxy_module modules/mod_proxy.so 
LoadModule proxy_connect_module modules/mod_proxy_connect.so 
LoadModule proxy_http_module modules/mod_proxy_http.so
#위 내용이 없다면 추가하면 된다
```

Confluence 6.0 버전 이상을 Synchrony와 사용중이라면 **Apache 2.4.10 버전 이상**을 사용해야하고 **mod_proxy_wstunnel** 그리고 **mod_rewrite** 모듈이 활성화 되어 있는지 확인해야한다.
</details>

mod_proxy를 사용해 가상 호스트 구성

<details>
<summary>실제 구성 화면</summary>

![image](media://77a4b63a-a9cc-4878-8265-594df4c15bf0)
</details>

- Apache reverse proxy에서 하나의 어플리케이션만 수행한다면, 아래의 가상호스트 블럭을 사용한다.
  **mod_proxy**
- 여러개의 어플리케이션을 똑같은 proxy에서 사용한다면 이름 기반의 가상호스트를 사용한다. 아래 예시는 **같은 도메인 아래 다른 context path를 사용**할 때다.
  **mod_proxy**
- 여러개의 어플리케이션을 사용하면서 **각각 다른 도메인**을 가지고 있을 때는 아래 예를 사용한다.
  **mod_proxy**
- Apache 재시작
  **Debian and Ubuntu**
  **Fedora and CentOS**
- CentOS SELinux 정책 수정
  CentOS에선 디폴트로 SELinux 정책이 httpd가 네트워크에 연결되는 것을 막는다. 이 경우 httpd의 error_log에서 아래 오류를 볼 수 있다.
  **/var/log/httpd/error_log**
  이 오류를 해결하기 위해선 아래 커맨드로 SELinux 정책을 수정한다.

### 마무리

- 모든 어플리케이션 재시작
- 어플리케이션 Base URL 수정
- 설정 완료


> ℹ️ **참조 페이지**
> ℹ️ 
> ℹ️ - [Proxying Atlassian server applications with Apache HTTP Server (mod_proxy_http)](https://confluence.atlassian.com/kb/proxying-atlassian-server-applications-with-apache-http-server-mod_proxy_http-806032611.html)
> ℹ️ - [Set a context path for Atlassian application](https://confluence.atlassian.com/kb/set-a-context-path-for-atlassian-applications-836601189.html)
> ℹ️ - [Migrate server.xml customizations to bitbucket.properties](https://confluence.atlassian.com/bitbucketserver/migrate-server-xml-customizations-to-bitbucket-properties-897811761.html)