R
R
RomanSS2016-12-20 14:19:14
Nginx
RomanSS, 2016-12-20 14:19:14

How to properly configure Nginx to redirect static from nodejs?

Tell me how to fix the settings so that static from nodejs is given to nginx, due to the fact that there is such a rule

location ~* ^(?!/phpmyadmin/).+\.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv|txt|xml|docx|xl$
                access_log off;
                expires 30d;
        }

#перенаправление на NodeJS
        location /node/ {
                #ip:порт nodeJS
                proxy_pass http://127.0.0.1:8000/;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection $connection_upgrade;
        }

#остальное отдается апачу

and in server.js
// Routing
app.use(express.static(__dirname + '/public'));

The server starts successfully, but the problem is that due to the first rule for returning statics, it takes statics from nodejs and tries to load them from another folder. I understand that I need to register the return of statics for nodejs, but I can’t figure out how to do this

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question