{"id":3839,"date":"2019-11-14T17:27:38","date_gmt":"2019-11-14T17:27:38","guid":{"rendered":"http:\/\/www.gubatron.com\/blog\/?p=3839"},"modified":"2019-11-15T06:49:37","modified_gmt":"2019-11-15T06:49:37","slug":"nginx-server-configuration-for-a-wordpress-instance-served-from-a-urls-subdirectory","status":"publish","type":"post","link":"https:\/\/www.gubatron.com\/blog\/nginx-server-configuration-for-a-wordpress-instance-served-from-a-urls-subdirectory\/","title":{"rendered":"nginx server configuration for a wordpress instance served from a URL&#8217;s subdirectory"},"content":{"rendered":"<p>You want to serve a wordpress instance on a website&#8217;s domain url but not at the path&#8217;s root, you want it under a sub-directory, for example &#8220;blog&#8221;, the same as this blog:<\/p>\n<p><a href=\"https:\/\/www.gubatron.com\/blog\">https:\/\/www.gubatron.com\/blog\u00a0<\/a><\/p>\n<p>Here&#8217;s how my NGINX&#8217;s server block for &#8216;www.gubatron.com&#8217; looks like at the moment (https\/ssl hasn&#8217;t been configured yet)<\/p>\n<p>[pastacode lang=&#8221;javascript&#8221; path_id=&#8221;fc6f967d7689931c81e9e9691b714f29&#8243; file=&#8221;&#8221; highlight=&#8221;&#8221; lines=&#8221;&#8221; provider=&#8221;gist&#8221;\/]<\/p>\n<p>Here is the equivalent in lighttpd, too bad lighttpd has no plans for HTTP2, it&#8217;s much friendlier and flexible to configure than nginx in my humble opinion.<\/p>\n<p>[pastacode lang=&#8221;javascript&#8221; path_id=&#8221;d6e2f73026cf61ac74e1d45ce8a401b5&#8243; file=&#8221;&#8221; highlight=&#8221;&#8221; lines=&#8221;&#8221; provider=&#8221;gist&#8221;\/]<\/p>\n<p>I used to host this website and wordpress on lighttpd, lighttpd&#8217;s config file is very powerful, it&#8217;s all based on matching server variables and applying rules, I will miss it dearly, things like having a compressed file cache and it&#8217;s flexibility, but I have to move on to nginx if I want to use http2, the lighttpd has no plans for http2 support and it&#8217;s just much faster and efficient than http 1.1.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You want to serve a wordpress instance on a website&#8217;s domain url but not at the path&#8217;s root, you want it under a sub-directory, for example &#8220;blog&#8221;, the same as this blog: https:\/\/www.gubatron.com\/blog\u00a0 Here&#8217;s how my NGINX&#8217;s server block for &#8216;www.gubatron.com&#8217; looks like at the moment (https\/ssl hasn&#8217;t been configured yet) [pastacode lang=&#8221;javascript&#8221; path_id=&#8221;fc6f967d7689931c81e9e9691b714f29&#8243; file=&#8221;&#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[15,43],"tags":[618,1613,1615,1614,1117],"class_list":["post-3839","post","type-post","status-publish","format-standard","hentry","category-code","category-linux","tag-lighttpd","tag-nginx","tag-relative-path","tag-subdirectory","tag-wordpress"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5Unzf-ZV","jetpack-related-posts":[{"id":3899,"url":"https:\/\/www.gubatron.com\/blog\/how-to-suppress-useless-mod_openssl-lighttpd-error-messages-from-var-log-syslog-in-ubuntu\/","url_meta":{"origin":3839,"position":0},"title":"[linux\/ubuntu] How to suppress useless mod_openssl\/lighttpd error messages from appearing in \/var\/log\/syslog","author":"gubatron","date":"August 7, 2020","format":false,"excerpt":"Sometimes you have a bunch of useless errors creating unnecessary disk I\/O on your server, disk I\/O that should be used towards serving your user's requests efficiently. In this case a site running on lighttpd keeps logging several times per second the following message, creating too much noise and making\u2026","rel":"","context":"In &quot;Linux&quot;","block_context":{"text":"Linux","link":"https:\/\/www.gubatron.com\/blog\/category\/linux\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3591,"url":"https:\/\/www.gubatron.com\/blog\/upgrading-your-wordpress-blog-to-php-7-0-on-ubuntu-xenial\/","url_meta":{"origin":3839,"position":1},"title":"Upgrading your wordpress blog to PHP 7.0 on Ubuntu Xenial","author":"gubatron","date":"September 7, 2016","format":false,"excerpt":"If you're about to upgrade your Ubuntu server to 16.04 (Xenial) you might want to take advantage of the new PHP 7.0 which is as fast or more than Facebook's HHVM, or perhaps during the upgrade process a few things may have broken and perhaps that's why you're here Make\u2026","rel":"","context":"In &quot;Linux&quot;","block_context":{"text":"Linux","link":"https:\/\/www.gubatron.com\/blog\/category\/linux\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2593,"url":"https:\/\/www.gubatron.com\/blog\/lighttpd-allow-access-control-allow-origin-headers-on-the-server-status-page\/","url_meta":{"origin":3839,"position":2},"title":"lighttpd, allow &#8220;Access-Control-Allow-Origin:*&#8221; headers on the server status page","author":"gubatron","date":"November 29, 2011","format":false,"excerpt":"Maybe there's someone out there who needs to read the output of lighttpd's status for monitoring purpose like me tonight, and also, like me, you want to do this using JavaScript, but your browser gives you this nasty error: XMLHttpRequest cannot load http:\/\/otherSubdomain.server.com\/lighttpd-status-url-you-have-configured. Origin http:\/\/requestingSubdomain.server.com is not allowed by Access-Control-Allow-Origin.\u2026","rel":"","context":"In &quot;AJAX&quot;","block_context":{"text":"AJAX","link":"https:\/\/www.gubatron.com\/blog\/category\/ajax\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3376,"url":"https:\/\/www.gubatron.com\/blog\/what-to-do-when-lighttpd-wont-start-and-wont-give-out-any-error-output\/","url_meta":{"origin":3839,"position":3},"title":"What to do when lighttpd won&#8217;t start and won&#8217;t give out any error output?","author":"gubatron","date":"February 4, 2015","format":false,"excerpt":"So you upgraded your server, or just all of a sudden you try to start lighttpd, it says the server started ok, but you check and there's no lighttpd process. You then go after your error log files, and nothing... what the fuck is happening? try this to attempt to\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":566,"url":"https:\/\/www.gubatron.com\/blog\/apache2-enablesendfile\/","url_meta":{"origin":3839,"position":4},"title":"Apache2: EnableSendFile","author":"gubatron","date":"August 7, 2007","format":false,"excerpt":"Aunque no recomiendo apache para servir archivos estaticos (demasiado overhead, es mejor que le eches un ojo a nginx o a lighttpd), encontre hoy una directiva que puede eliminar un poco el overhead al hacer una llamada directa al sistema -> sendfile. De momento lo que hice en uno de\u2026","rel":"","context":"In &quot;Geeklife&quot;","block_context":{"text":"Geeklife","link":"https:\/\/www.gubatron.com\/blog\/category\/geeklife\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4038,"url":"https:\/\/www.gubatron.com\/blog\/will-using-nice-20-on-nginx-and-php-fpm-make-my-wordpress-site-go-faster\/","url_meta":{"origin":3839,"position":5},"title":"Will using `nice -20` on nginx and php-fpm make my WordPress site go faster?","author":"gubatron","date":"June 7, 2023","format":false,"excerpt":"The nice command in Unix and Linux systems is used to alter the scheduling priority of processes. A lower nice value means higher priority. However, using nice -20 to set the highest priority for your PHP-FPM and Nginx processes isn't likely to have a significant impact on your WordPress site's\u2026","rel":"","context":"In &quot;Linux&quot;","block_context":{"text":"Linux","link":"https:\/\/www.gubatron.com\/blog\/category\/linux\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2022\/12\/progress_image_100_7fdc7b72-6c19-42f5-affe-d055d02d6f8e.webp?fit=1024%2C1024&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2022\/12\/progress_image_100_7fdc7b72-6c19-42f5-affe-d055d02d6f8e.webp?fit=1024%2C1024&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2022\/12\/progress_image_100_7fdc7b72-6c19-42f5-affe-d055d02d6f8e.webp?fit=1024%2C1024&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2022\/12\/progress_image_100_7fdc7b72-6c19-42f5-affe-d055d02d6f8e.webp?fit=1024%2C1024&ssl=1&resize=700%2C400 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/3839","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/comments?post=3839"}],"version-history":[{"count":12,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/3839\/revisions"}],"predecessor-version":[{"id":3851,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/3839\/revisions\/3851"}],"wp:attachment":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/media?parent=3839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/categories?post=3839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/tags?post=3839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}