server {
listen 80;
server_name www.dominio.xxx;
rewrite ^/(.*) http://dominio.xxx/$1 permanent;
}
server {
listen 80;
server_name dominio.xxx;
root /var/www/dominio;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args ;
}
location ~ /favicon.ico {
access_log off;
log_not_found off;
}
location ~ \.php$ {
try_files $uri /index.php;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
if (!-e $request_filename) {
rewrite ^.+?(/wp-.*) $1 last;
rewrite ^.+?(/.*\.php)$ $1 last;
rewrite ^ /index.php last;
}
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
expires 7d;
}
# Deny public access to wp-config.php
location ~* wp-config.php {
deny all;
}
}