I have node.js server running locally on windows 7 and would like to add Nginx server to serve static files. After downloading and extracting Nginx, when I run nginx.exe, Nginx is accessible to node only inside the nginx folder.
How can I make it run automatically and accessible globally in node? Going over various tutorials, they describe the configuration for linux but I assume there are differences in the .conf file? If so, what are they?
Edit
Using express.js I keep getting 404 when trying to serve a css file... Here is the request URL: 127.0.0.1:3000/public/css/style.css And here is the config file:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 64;
sendfile on;
keepalive_timeout 65;
server {
listen 0.0.0.0:80;
server_name localhost;
access_log path_to_log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:3000/;
proxy_redirect off;
}
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
# access_log off;
root path_to_local_folder_with_static_files;
expires 15d;
}
}