How to configure NGINX for Confluence with synchrony enabled & JIRA in a single server

## Task/Goal

 Let Confluence work with **synchrony** feature enabled !

 **Collaborative editing for Confluence Server**
 cf. https://developer.atlassian.com/confdev/collaborative-editing-for-confluence-server

 - with Confluence synchrony on --> Confluence freezes immediately after creating new page ??? :cry: 
 - without synchrony --> Confluence works but we want co-edit feature ...

 ... maybe related with this ...
 https://confluence.atlassian.com/jirakb/unable-to-create-issue-after-upgrading-to-jira-7-815588418.html 

## Prerequisite
 - [x] installed Oracle Linux 7.3
    - [ ] `cat /etc/oracle-release`
 - [x] installed nginx 1.10.3
    - [ ] `nginx -V`
 - [x] installed JIRA 7.3
 - [x] installed Confluence 6.0

## NGINX configuration


```bash:/etc/nginx/conf.d/confluence.conf
server {
    server_name confluence-server-name;

    send_timeout 180;

    location /synchrony {
        proxy_set_header        Host $host;
        proxy_set_header        X-Forwarded-Host $host;
        proxy_set_header        X-Forwarded-Server $host;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Real-IP  $remote_addr;
        proxy_pass              http://127.0.0.1:8091;
        proxy_http_version      1.1;
        proxy_set_header        Upgrade $http_upgrade;
        proxy_set_header        Connection "upgrade";
    }
 
    location / {
        proxy_set_header        Host $host;
        proxy_set_header        X-Forwarded-Host $host;
        proxy_set_header        X-Forwarded-Server $host;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Real-IP  $remote_addr;
        proxy_pass              http://127.0.0.1:8090;
    }
}
```


```bash:/etc/nginx/conf.d/jira.conf
server {
    server_name jira-server-name;
        
    location / {
        proxy_set_header        Host $host;
        proxy_set_header        X-Forwarded-Host $host;
        proxy_set_header        X-Forwarded-Server $host;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Real-IP  $remote_addr;
        proxy_pass              http://127.0.0.1:8080;
    }
}
```


## tomcat configuration 
 - point
    - server.xml : add **proxyName=** and **proxyPort=** parameters in <Connector>  

```xml:/usr/local/atlassian/confluence/conf/server.xml
        <Connector port="8090" connectionTimeout="20000" redirectPort="8443"
                maxThreads="48" minSpareThreads="10"
                enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"
                protocol="org.apache.coyote.http11.Http11NioProtocol"
                proxyName="confluence-server-name" proxyPort="80" />
```

```xml:/usr/local/atlassian/jira/conf/server.xml
        <!-- Nginx Proxy Connector -->
        <Connector port="8080" maxThreads="150" minSpareThreads="25" connectionTimeout="20000"
          enableLookups="false" maxHttpHeaderSize="8192" protocol="HTTP/1.1"
          useBodyEncodingForURI="true" redirectPort="8443" acceptCount="100" disableUploadTimeout="true"
          proxyName="jira-server-name" proxyPort="80"/>

        <!-- Standard HTTP Connector -->
        <Connector port="8082" maxThreads="150" minSpareThreads="25" connectionTimeout="20000"
          enableLookups="false" maxHttpHeaderSize="8192" protocol="HTTP/1.1"
          useBodyEncodingForURI="true" redirectPort="8443" acceptCount="100" disableUploadTimeout="true"/>
```



## Done
![2017-04-22_121234.jpg](https://qiita-image-store.s3.amazonaws.com/0/114634/848107e6-47c9-30ad-2070-8b8b6501f421.jpeg)

:smile: :thumbsup: