Flera gånger Men tycker den är väldigt otydlig har även sökt runt på Google.
Här är min config som jag testade senast.
server {
listen 80; ## listen for ipv4
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name www.domain.com domain.com;
access_log /var/log/nginx/localhost.access.log;
root /var/www/domain.com;
access_log /var/log/nginx/YOURDOMAIN.access.log;
error_log /var/log/nginx/YOURDOMAIN.error.log info;
index index.php;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# This matters if you use drush
location = /backup {
deny all;
}
# Very rarely should these ever be accessed outside of your lan
location ~* \.(txt|log)$ {
allow 127.0.0.1;
deny all;
}
location ~ \..*/.*\.php$ {
return 403;
}
location / {
# This is cool because no php is touched for static content
try_files $uri $uri/ @rewrite;
expires max;
}
location @rewrite {
# Some modules enforce no slash (/) at the end of the URL
# Else this rewrite block wouldn't be needed (GlobalRedirect)
rewrite ^/(.*)$ /index.php?q=$1;
#Mitt senaste försök här nedan
rewrite ^/public/images/(.*).(png|jpeg|jpg|gif)$ /index.php?q=/sites/default/files/$1.$2;
#Ett annat
rewrite ^/sites/default/files/(.*).(png|jpeg|jpg|gif)$ /public/images/$1.$2;
}
Har även testat olika config med hjälp av en separat location{}. Om deras dokumentation var lite tydligare skulle det nog vara lite lättare eller så har jag missat något. Kanske har något med Drupal att göra.