nginx and Confluence - Base URL and page creation issue

I have set up nginx and Confluence on Ubuntu 16.04 according to the guide from Atlassian, and it works.  However, setting my Base URL to the proxied address (e.g., helpdesk.example.com or helpdesk.example.com:8090) doesn't allow me to save new pages.

I can browse the entirety of my Confluence sites with no issues, but when I go to save a new page, it claims a server disconnection or under the extended create dialog just spins forever without populating the options.  I can successfully edit and save already created pages.  If I go directly to helpdesk.example.com:8090, everything works as expected (I can create, save, etc). 

What do I need to change in order to never need to go to helpdesk.example.com:8090?

*Note, I don't use the /confluence path in my settings, as I want my users to be able to directly go to just the flat http://helpdesk.example.com without needing to go to http://helpdesk.example.com/confluence

 

My nginx entry is like so:

server {
    listen helpdesk.example.com:80;
    server_name helpdesk.example.com;
    location / {
        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_pass http://localhost:8090/;
    }
}

and my server.xml is like this:

<Server port="8000" shutdown="SHUTDOWN" debug="0">
    <Service name="Tomcat-Standalone">
        <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" />
 
        <Engine name="Standalone" defaultHost="localhost" debug="0">
 
            <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="false">
 
                <Context path="" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true">
                    <!-- Logger is deprecated in Tomcat 5.5. Logging configuration for Confluence is specified in confluence/WEB-INF/classes/log4j.properties -->
                    <Manager pathname="" />
                    <Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60" />
                </Context>
            </Host>
 
        </Engine>

 

 Any pointers would be appreciated!



 

 

1 answer

1 accepted

0 vote
Steven Behnke Community Champion Oct 06, 2016

The first thing I see is that you're missing the proxyName and proxyPort attributes from your connector element. You need to add the proper detail to Tomcat's configuration, which again is your server.xml connector element.

https://tomcat.apache.org/tomcat-5.5-doc/config/http.html

Set the URL for redirection

Next, set the URL for redirection. In the same <CONFLUENCE-INSTALL>/conf/server.xml file, locate this code segment:

&lt;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"/&gt;

And append the last line:

&lt;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="www.example.com" proxyPort="80"/&gt;

That was exactly what was wrong.  I didn't see anything about those two parameters in Atlassian's KB articles on nginx.  Thank you so much, everything is working properly now.

 

Steven Behnke Community Champion Oct 06, 2016

Cool! smile No problem, good luck!

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

583 views 20 11
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you