N
N
Natapr02016-12-01 19:47:39
Nginx
Natapr0, 2016-12-01 19:47:39

Nginx + apache + redmine how to setup location?

Installed nginx frontend + apache backend
Installed redmine with passanger module for apache

location / {
                proxy_pass http://127.0.0.1:8080;
                include /etc/nginx/proxy_params;
        }

        location ~* \.(jpg|jpeg|gif|png|js)$ {
                root /usr/share/redmine/public/;
        }

Everything works fine at first glance.
The problem is loading files that actually end in jpg|jpeg|gif|png|js
i.e. if you try to upload files in redmine, then it does not work, since the upload works through uploads.js,
which is not located because it is searched for in /usr/share/redmine/public/ Removed
js for the test, leaving only this jpg|jpeg |gif|png , the files are loading, but for example I can't access them. Those. when I click on the downloaded file in the list, the path to it is /attachments/download/12/1.jpg 404 Not Found, which is kindly reported by nginx, which is also logical.
The question is how to make it so that the static is given and at the same time the loading of user files and redmine scripts work?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
ky0, 2016-12-01
@ky0

Throw out the Apache as an extra link?

A
Alexander Chernykh, 2016-12-01
@sashkets

do nginx+php-fpm correctly, even if you have apache

S
Sheryorg, 2016-12-08
@Sheryorg

Here is my nginx config for redmine. The redmine itself is spinning in the docker, but this does not change the essence. Apache is not needed.
server {
...
root /opt/srv/redmine/public;
location / {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 3600;
proxy_connect_timeout 3600;
proxy_pass http://127.0.0.1:3000;
}
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question