You're absolutely right. When using: location ~* ^.+\.(jpg|jpeg|gif|png)$ { access_log off; expires 30d; } It ignores my: location / { index index.php index.html index.htm; root /home/user/public_html; } and tries to load the image from /usr/local/nginx/html