0

Ok

I have Confluence running under Ubuntu 16.04. I now have JIRA running as well on the same server. Nginx is forwarding port 8090 to port 80 without issue for Confluence so I can just goto domain/confluence. I set up JIRA to work this way as well.

I keep getting a 404 Not Found error from Nginx.

When I tail the Nginx error log, I am seeing this:

2016/07/01 17:27:29 [error] 50688#50688: *2 open() "/usr/share/nginx/html/jira" failed (2: No such file or directory), client: xx.xx.xx.xx, server: www.xxxxxx.net, request: "GET /jira HTTP/1.1", host: "xxxxx.net"

I know why this error is happening but I cannot for the life of me figure out where Nginx is getting the path its looking for from. Its technically passing the traffic correctly to Apache but its appending /jira to the end of the default directory which is resulting in the 404 not found because that location literally does not exist.

Where is Nginx reading the default location from?

I removed everything in my sites-available and sites-enabled directories minus the one needed to set up the forwarding. Apache also has no sites in either of its directories. I checked the Nginx.conf and I dont see that path there. I have restarted all of my services as well.

Confluence sites-enabled config

root@confluence:/etc/nginx/sites-enabled# cat confluence
server {

listen www.xxxx.net:80;
    server_name www.xxxx.net;
    location /confluence {
        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/confluence;
    }
}

JIRA sites-enabled config

root@confluence:/etc/nginx/sites-enabled# cat jira
    server {
        listen www.xxxx.net:80;
        server_name www.xxxx.net;
        location /jira {
        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:8080/jira;
        client_max_body_size 10M;
    }
}

I am at a loss!!

EDIT

So it seems like Nginx is reading this from this file:

/etc/nginx/sites-available/default

The issue here, is this file no longer exists. I have stopped/started/reloaded Nginx. Its still wanting to append that directory before the /jira.

2
  • Check /etc/nginx/sites-enabled. Is a symlink to the default config file present there?
    – Thomas Ward
    Jul 2, 2016 at 0:57
  • The only thing present in that directory are the two files outlined above. Jul 2, 2016 at 1:00

1 Answer 1

0

To resolve this, I ended up removing Nginx all together. I only had two server blocks setup so it wasnt a big deal to restore everything.

Once I installed Nginx and setup my server blocks, everything was working fine.

apt-get purge nginx
apt-get install nginx

I can see how this might not be the best thing but it resolved my issue none the less.

Also instead of having two separate server blocks I configured one as such:

    server {
    listen www.xxxx.net:80;
    server_name www.xxxx.net;
    location / {

    location /confluence {
        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/confluence;
        }

    location /jira {
        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:8080/jira;
        client_max_body_size 10M;
        }
    }
}  

It was important that I added the base location location / as without this I wasnt allowed to have my locations set as /confluence /jira Having them without the base location resulted in this error:

location "/jira" is outside location

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .