{"id":1963,"date":"2018-09-18T12:15:27","date_gmt":"2018-09-18T11:15:27","guid":{"rendered":"https:\/\/www.thenaylors.co.uk\/wordpress\/?p=1963"},"modified":"2018-10-29T13:46:23","modified_gmt":"2018-10-29T13:46:23","slug":"omv-wordpress-and-nginx-a-further-update","status":"publish","type":"post","link":"https:\/\/www.thenaylors.co.uk\/wordpress\/omv-wordpress-and-nginx-a-further-update\/","title":{"rendered":"OMV &#8211; WordPress and NGINX &#8211; a further update"},"content":{"rendered":"<p>I was struggling with WordPress and permalinks.&nbsp; 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.<\/p>\n<p>Google is wonderful as I found this site &#8211; <a href=\"http:\/\/www.netz39.de\/2014\/installation-of-wordpress-in-a-subdirectory-with-nginx\/\">http:\/\/www.netz39.de\/2014\/installation-of-wordpress-in-a-subdirectory-with-nginx\/<\/a>.<\/p>\n<p>I thought it was something to do with the way the try_files was working in relation to fastcgi.&nbsp; It was.<\/p>\n<p>So the wordpress config was update to be as below.&nbsp; Note the location rewrite needs to be at the server level.<\/p>\n<p>&nbsp;<\/p>\n<p>[php]<br \/>\nlocation @wordpress_rewrite {<br \/>\nrewrite ^\/wordpress\/(.*)$ \/wordpress\/index.php?$1;<br \/>\n}<\/p>\n<p>location \/wordpress {<br \/>\nalias \/media\/13eaa8c9-07ee-4dfc-9d1b-adfae0f0248d\/www\/wordpress;<\/p>\n<p>add_header Content-Security-Policy &quot;default-src &#8216;self&#8217; https: data: &#8216;unsafe-inline&#8217; &#8216;unsafe-eval&#8217;;&quot; always;<br \/>\nadd_header X-Content-Type-Options nosniff;<br \/>\nadd_header X-XSS-Protection &quot;1; mode=block&quot;;<br \/>\nadd_header X-Robots-Tag none;<br \/>\nadd_header X-Download-Options noopen;<br \/>\nadd_header X-Permitted-Cross-Domain-Policies none;<\/p>\n<p>index index.php;<br \/>\ntry_files $uri $uri\/ @wordpress_rewrite;<\/p>\n<p>location ~* \/wordpress\/(?:uploads|files)\/.*\\.php$ {<br \/>\ndeny all;<br \/>\n}<\/p>\n<p>location ~ ^\/wordpress\/(.+\\.php)$ {<br \/>\nalias                           \/media\/13eaa8c9-07ee-4dfc-9d1b-adfae0f0248d\/www\/wordpress\/$1;<br \/>\nfastcgi_split_path_info         ^(.+\\.php)(\/.*)$;<br \/>\ninclude fastcgi.conf;<br \/>\nfastcgi_index index.php;<br \/>\nfastcgi_param SCRIPT_FILENAME $request_filename;<br \/>\nfastcgi_pass unix:\/var\/run\/fpm-19e311b1-25e1-4257-8dbc-d49c5ec59015.sock;<br \/>\n}<\/p>\n<p>location = \/wordpress\/favicon.ico {<br \/>\naccess_log off;<br \/>\nlog_not_found off;<br \/>\n}<\/p>\n<p>location = \/wordpress\/robots.txt {<br \/>\nallow all;<br \/>\naccess_log off;<br \/>\nlog_not_found off;<br \/>\n}<\/p>\n<p>location ~ \/wordpress\/\\. {<br \/>\ndeny all;<br \/>\n}<\/p>\n<p>location ~* \/wordpress\/(?:config)\/.*\\.php$ {<br \/>\ndeny all;<br \/>\n}<\/p>\n<p>location ~* \/wordpress\/\\.(js|css|png|jpg|jpeg|gif|ico)$ {<br \/>\nexpires max;<br \/>\nlog_not_found off;<br \/>\n}<br \/>\n}<\/p>\n<p>[\/php]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was struggling with WordPress and permalinks.&nbsp; 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 &#8211; http:\/\/www.netz39.de\/2014\/installation-of-wordpress-in-a-subdirectory-with-nginx\/. I thought it was something to &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.thenaylors.co.uk\/wordpress\/omv-wordpress-and-nginx-a-further-update\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;OMV &#8211; WordPress and NGINX &#8211; a further update&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[173,4],"tags":[],"class_list":["post-1963","post","type-post","status-publish","format-standard","hentry","category-nginx","category-wordpress"],"_links":{"self":[{"href":"https:\/\/www.thenaylors.co.uk\/wordpress\/wp-json\/wp\/v2\/posts\/1963","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thenaylors.co.uk\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thenaylors.co.uk\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thenaylors.co.uk\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thenaylors.co.uk\/wordpress\/wp-json\/wp\/v2\/comments?post=1963"}],"version-history":[{"count":6,"href":"https:\/\/www.thenaylors.co.uk\/wordpress\/wp-json\/wp\/v2\/posts\/1963\/revisions"}],"predecessor-version":[{"id":2010,"href":"https:\/\/www.thenaylors.co.uk\/wordpress\/wp-json\/wp\/v2\/posts\/1963\/revisions\/2010"}],"wp:attachment":[{"href":"https:\/\/www.thenaylors.co.uk\/wordpress\/wp-json\/wp\/v2\/media?parent=1963"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thenaylors.co.uk\/wordpress\/wp-json\/wp\/v2\/categories?post=1963"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thenaylors.co.uk\/wordpress\/wp-json\/wp\/v2\/tags?post=1963"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}