我正在提供资源的静态页面。 不幸的是,我无法打开图像,而JS和CSS文件正在通过相当好。
尝试访问文件时,我只收到403 (Forbidden)
。
目录hiarachy:
/var/www/servers/new.test.com index.html static/ img/ css/ js/
configuration:
server { listen 80; server_name area1.test.com; access_log /var/log/nginx/new_test.access.log; error_log /var/log/nginx/new_test.error.log; root /var/www/servers/new.test.com; index index.html index.htm index.php; charset utf-8; location / { try_files $uri $uri/ =404; } # Media: images, icons, video, audio, HTC location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { expires 1m; access_log off; add_header Cache-Control "public"; } # CSS and Javascript location ~* \.(?:css|js)$ { expires 1m; access_log off; add_header Cache-Control "public"; } }
请忽略到期时间。
文件权限不允许Web服务器读取文件。 很可能文件的所有者/组与Web服务器用户/组不匹配,并且其他人不允许读取这些文件。