{"id":1062,"date":"2014-01-01T20:43:13","date_gmt":"2014-01-01T20:43:13","guid":{"rendered":"http:\/\/www.omniweb.com\/wordpress\/?p=1062"},"modified":"2014-01-01T20:49:47","modified_gmt":"2014-01-01T20:49:47","slug":"nginx-configuration-for-wordpress","status":"publish","type":"post","link":"https:\/\/www.omniweb.com\/wordpress\/?p=1062","title":{"rendered":"nginx configuration for wordpress"},"content":{"rendered":"<p>There is a lot of information around the web about how to do this, but once I followed <a href=\"http:\/\/wiki.nginx.org\/WordPress\">this page<\/a>, things worked correctly with &#8220;pretty URLs&#8221; and my wordpress site&#8217;s theme.<br \/>\nFor future reference, here is the magic:<\/p>\n<pre><code># Upstream to abstract backend connection(s) for php\r\nupstream php {\r\n        server unix:\/tmp\/php-cgi.socket;\r\n        server 127.0.0.1:9000;\r\n}\r\n \r\nserver {\r\n        ## Your website name goes here.\r\n        server_name domain.tld;\r\n        ## Your only path reference.\r\n        root \/var\/www\/wordpress;\r\n        ## This should be in your http block and if it is, it's not needed here.\r\n        index index.php;\r\n \r\n        location = \/favicon.ico {\r\n                log_not_found off;\r\n                access_log off;\r\n        }\r\n \r\n        location = \/robots.txt {\r\n                allow all;\r\n                log_not_found off;\r\n                access_log off;\r\n        }\r\n \r\n        location \/ {\r\n                # This is cool because no php is touched for static content. \r\n                # include the \"?$args\" part so non-default permalinks doesn't break when using query string\r\n                try_files $uri $uri\/ \/index.php?$args;\r\n        }\r\n \r\n        location ~ \\.php$ {\r\n                #NOTE: You should have \"cgi.fix_pathinfo = 0;\" in php.ini\r\n                include fastcgi.conf;\r\n                fastcgi_intercept_errors on;\r\n                fastcgi_pass php;\r\n        }\r\n \r\n        location ~* \\.(js|css|png|jpg|jpeg|gif|ico)$ {\r\n                expires max;\r\n                log_not_found off;\r\n        }\r\n}\r\n<\/code><\/pre>\n<blockquote><p>With this configuration we should be able to serve wordpress very easily. Once you setup your backend (php-cgi or php-fpm) should work perfectly.<\/p><\/blockquote>\n<p>&#8211; <a href=\"http:\/\/wiki.nginx.org\/WordPress\">http:\/\/wiki.nginx.org\/WordPress<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>There is a lot of information around the web about how to do this, but once I followed this page, things worked correctly with &#8220;pretty URLs&#8221; and my wordpress site&#8217;s theme. For future reference, here is the magic: # Upstream &hellip; <a href=\"https:\/\/www.omniweb.com\/wordpress\/?p=1062\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1062"}],"collection":[{"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1062"}],"version-history":[{"count":4,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1062\/revisions"}],"predecessor-version":[{"id":1066,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1062\/revisions\/1066"}],"wp:attachment":[{"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1062"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1062"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}