I have 2 linux servers on my local network. I use the PC with the IP 192.168.1.111 as application server to run my node application on port 8080. As web server I use NGINX on a PC with the IP 192.168.1.100 and configured it as reverse proxy.
In a Network Tab of the Browser I see that all files are served properly (Status 200 OK). But all static files are not displayed.
Static files (css, js, images, fonts) are located in subfolders inside /var/www/domain.com/public
Any idea why this issue occurs?
Here my nginx.conf file:
user www-data;
worker_processes 2;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/domain.com/access.log;
error_log /var/log/nginx/domain.com/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
Here the /etc/nginx/sites-enabled/domain.com file
upstream appserver {
server 192.168.1.111:8080;
}
server {
listen 80;
server_name domain.com www.domain.com;
root /var/www/domain.com/public;
location ~ ^/(images/|js/|css/|media/|favicon.ico) {
#access_log off;
expires off;
}
location / {
proxy_pass http://appserver;
include /etc/nginx/proxy_params;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
And here the access.log file
192.168.1.105 - - [26/Jan/2017:21:33:54 +0100] "GET /images/shop.png HTTP/1.1" 200 13643 "http://192.168.1.100/home" "Mozilla/5.0 (X11; Linux x86_64) ..."
192.168.1.105 - - [26/Jan/2017:21:33:54 +0100] "GET /images/code.png HTTP/1.1" 200 13443 "http://192.168.1.100/home" "Mozilla/5.0 (X11; Linux x86_64) ..."
192.168.1.105 - - [26/Jan/2017:21:33:54 +0100] "GET /images/line.png HTTP/1.1" 200 13643 "http://192.168.1.100/home" "Mozilla/5.0 (X11; Linux x86_64) ..."
try_files $uri =404in your location?