Deploy Confluence on Hosted/Shared Web Space
Asked by Jaymz:

**My goal:**

Install Confluence on a hosted domain and be able to access it via [http://www.\<myDomain\>.com/confluence](http://www.foobar.com/confluence) on port 80. Eventually, I'd like to use SSL; however, I'd like to get it up and running/functional before messing with that.

**What I have done so far:**

Everything here: <https://confluence.atlassian.com/doc/installing-confluence-on-linux-from-archive-file-255362363.html>

Specifically, I have copied the most recent version of Confluence's tar.gz file and extracted to \~/confluence-install (install directory) and configured my home directory as \~/confluence-home. \*\*\* Because this is shared server space, my home (\~/) directory is my root directory.

At this point I was able to run the confluence-startup.sh and all things appear to start normally; unfortunately though, with the file locations I chose, I am unable to access the GUI. That said, I copied the entire \~/confluence-install directory to \~/www/\<myDomain\>/confluence. Although, once again, everything appeared to start normally, I still cannot access anything via [http://www.\<myDomain\>.com:8090/confluence](http://www.foobar.com/confluence).

I have validated that both default ports (8000 and 8090) are available using "netstat -anp \| grep 'portNumber'" and therefore have not modified \*/conf/server.xml.

<br />

**My problems:**

1) I have no idea where I should place files to make them publicly available as necessary, while at the same time, ensuring nothing is public that should not be for the sake of security.

2) I do not have root access, so have been unable to modify iptables to configure port forwarding (eventually it would be nice to not have to specify port in my URL).

3) Documentation appears to be sparse at best regarding deploying Confluence to a hosted/shared web space. I have been all through the Atlassian Documentation and Knowledge Bases with no luck.

I'm sure I have missed something in my haste to get some answers, but if anyone has any feedback, I would greatly appreciate it!


Answers:
author: Nic Brough -Adaptavist-
body: Hmm.

You seem to be talking as though Confluence is some form of file based web-site (e.g. "place files to make them publically accessible"). It is not. It's a web-based application that serves up content when you visit the server on the right url and port. You don't need to "make files available", and you don't put anything in www for a web server, you just run the application and visit it.

So, go back to the plain installation, where you are simply running Confluence. What does a browser **on the server** get if you visit [http://localhost:8080/confluence](http://localhost:8080) ?

comments: author: Jaymz
body: I appreciate the response @Nic Brough \[Adaptavist\]

I definitely understand that it's an application; I was given the impression that I could make it accessible using a public URL. It would be simple to just modify iptables to set up port forwarding, but I do not have the necessary permissions to do that on this shared/hosted server.

I only attempted to run it in the www folder in hopes that it would somehow automagically resolve.

I don't know of a way to run a browser on the server itself; I access via SFTP, SSH, or cPanel. It's RHEL server, so I suspect there isn't even a browser installed.

Any other ideas are welcome; it's completely overkill, but I may just have to get a dedicated IP from my hosting service provider.


author: Nic Brough -Adaptavist-
body: The reason I explained about it being an application was that you seem to be thinking in the wrong way about "making things accessible".

A server running applications (like JIRA), or web-servers serving up pages (Like apache or nginx publishing the contents of /var/www/) simply listens on an address and responds to incoming connections.

They don't actually care where they come from - you just need a route from \<somewhere\> to server/application. I don't know how to do that with your Cpanel stuff - last time I ran into Cpanel it was too poorly implemented to give the admins the access they needed to do anything useful, and the client moved on to other servers that did work. But, you need to tell it to route incoming connections to your services somehow.

If you can't run a browser on the server, you could try a simple command line "wget localhost:8080/confluence" - that should give you a bit of plan html which should contain Confluence's dashboard or setup page. If it refuses to connect or comes back with html with a dirty great error in it, then you should know what confluence is up to (although, I'd also tail the confluence logs to see if that says it's working or not)


author: Jaymz
body: Thanks again Nic... (So with the following, please keep in mind this is on a shared server, so my accesses are limited)

So you were right; I was definitely putting the cart in front of the horse. Confluence is not starting, apparently because it can't find Java. That's weird though because there is an environment variable set for Java:

```
echo $JAVA_HOME
```

Output:

```
/usr/local/jdk
```

=============================================================================

But the logs indicate that it can't find it:

```
tail catalina.out
```

Output:

```
/confluence-install/atlassian-confluence-5.10.1/bin/catalina.sh: line 401: 
```

```
/usr/local/jdk/bin/java: No such file or directory
```

=============================================================================

I'm now confused about the paths not matching so I assume symbolic links:

```
ls -la /usr/local |grep "\-&gt;"
```

```
Output:
```

```
bin -> /root/bin
```

```
ls -la /root/bin/java |grep "\-&gt;"
```

```
Output:
```

```
/root/bin/java -> /etc/alternatives/java*
```

```
ls -la /root/alternatives/java |grep "\-&gt;"
```

```
Output:
```

/root/alternatives/java -\> /usr/lib/jvm/jre-1.5.0-gcj/bin/java\*

```
ls -la /usr/lib/jvm/jre-1.5.0-gcj/bin/java |grep "\-&gt;"
```

```
Output:
```

/usr/lib/jvm/jre-1.5.0-gcj/bin/java -\> ../../../../../bin/gij\*

../../../../../bin/gij\* gets me back to /root/bin/gij

Not sure why the crazy/cryptic links back and forth, but now I'm wondering if I need to change my environment variable from

```
/usr/local/jdk to /root/bin/gij??? I may just need to reach out to my provider
```

at this point.


author: Nic Brough -Adaptavist-
body: The installation is making assumptions about where java might be installed because it can't necessarily work out where it might be.

Could you try simply

java -version

which java

The second one will tell you which java you are running - if the first line tells you that it is a valid version, then we can run through setting it up properly.


author: Jaymz
body: java -version:

java version "1.5.0"

which java:

/usr/bin/java


author: Nic Brough -Adaptavist-
body: Mmm, and the rest of the java -version output would be useful - it should tell you what the distribution is. For most Atlassian products, you'll want the Oracle distribution (previously Sun), but some stuff will work ok with Openjdk. The rest of the version output should tell us that.

However, 1.5 of any distrinution is way too old to support the more recent Atlassian stuff, so you might be looking at an upgrade anyway.


author: Jaymz
body: Yeah, sorry; I went back to edit my comment but couldn't post more than twice because I don't have enough points.

Full output:

java version "1.5.0"  
gij (GNU libgcj) version 4.4.7 20120313 (Red Hat 4.4.7-17)

So I realize that Oracle is the only JRE that is supported, but it's worth trying unless you know it to be futile. The problem now, is that I can't seem to find any documentation showing exactly how to tell Confluence where Java actually is. Any help in that department is appreciated.

In the meantime, I'll reach out to my provider and see if Oracle JRE/JDK can be installed instead.

Thanks!


author: Nic Brough -Adaptavist-
body: The usual trick is to force it - at the top of the setenv.sh file in \<confluence install\>/bin, explicitly set

JAVA_HOME=/your/path/to/java/install

PATH=$JAVA_HOME/bin:$PATH

Although the better way to do it is get the environment for the user running it correct with a proper java install and corrected environment variables. The setenv.sh trick is brute force.