Update to NGINX config for OpenMediaVault stops sites working … the fix.

Tried to access the sites I had set up via https://myurl/xxxx and they were not working today.

Checking the /etc/nginx/sites-available I could see that an update had been done on the 23 Oct and further checking shows this seemed to be to the openmediavault-webgui.

Checking the backup made a few weeks ago showed that the
listen [::]:80 ipv6only=off;
line had been changed to
listen 80;
and
listen [::]:443 ipv6only=off;
changed to
listen 443;
changing back seems to fix everything!
Not sure why right now.
The net result of this was that the 2nd server block I had for myurl was being ignored by NGINX.
Looks like I might need to fix this regularly from now on which is a bit of a pain!

OMV – WordPress and NGINX – a further update

I was struggling with WordPress and permalinks.  The prior onfiguration I had developed worked fine until I switched to permalinks and then it seems to be picked up the js css etc from the root and not the alias.

Google is wonderful as I found this site – http://www.netz39.de/2014/installation-of-wordpress-in-a-subdirectory-with-nginx/.

I thought it was something to do with the way the try_files was working in relation to fastcgi.  It was.

So the wordpress config was update to be as below.  Note the location rewrite needs to be at the server level.

 

location @wordpress_rewrite {
rewrite ^/wordpress/(.*)$ /wordpress/index.php?$1;
}

location /wordpress {
alias /media/13eaa8c9-07ee-4dfc-9d1b-adfae0f0248d/www/wordpress;

add_header Content-Security-Policy "default-src 'self' https: data: 'unsafe-inline' 'unsafe-eval';" always;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;

index index.php;
try_files $uri $uri/ @wordpress_rewrite;

location ~* /wordpress/(?:uploads|files)/.*\.php$ {
deny all;
}

location ~ ^/wordpress/(.+\.php)$ {
alias                           /media/13eaa8c9-07ee-4dfc-9d1b-adfae0f0248d/www/wordpress/$1;
fastcgi_split_path_info         ^(.+\.php)(/.*)$;
include fastcgi.conf;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/var/run/fpm-19e311b1-25e1-4257-8dbc-d49c5ec59015.sock;
}

location = /wordpress/favicon.ico {
access_log off;
log_not_found off;
}

location = /wordpress/robots.txt {
allow all;
access_log off;
log_not_found off;
}

location ~ /wordpress/\. {
deny all;
}

location ~* /wordpress/(?:config)/.*\.php$ {
deny all;
}

location ~* /wordpress/\.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}