Answer the question
In order to leave comments, you need to log in
Nginx PHP + NodeJS how to distribute static files?
Hello. PHP and NodeJS are running on the same domain. NodeJS handles requests that go to /node-js, everything else is handled by PHP. I can't figure out how to distribute a static folder from under NodeJS. PHP and NodeJS are in different directories. Here is an example config
server {
listen 443 ssl;
server_name www.example.com;
root /home/php-project/public;
index index.php;
location / {
autoindex off;
try_files $uri $uri/ /index.php?$query_string;
}
location /node-js {
proxy_pass http://localhost:5555;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
}
} #### End server setup
location /node-js{
proxy_pass http://localhost:5555;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
root /home/node-js;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question