I've posted this question on WP.SE, but got no replies. In the meantime I figured a solution involving proxy_pass
, but it comes with a few downsides.
I have a subdomain installation of Wordpress that I'd like to serve instead at /blog
. This must be an FAQ, but I haven't nailed the search terms for it (/blog
being so common doesn't help).
Where can I find a full nginx config file and wp-config settings that have WordPress live at /blog? Do I need to alter any WP settings in its MySQL database? Is it practical to move my existing instance, or should I start from scratch?
If you already changed you site URL, as you stated in the other question, you can try with alias location, inside the existing server block.
It should look something like this
This is assuming your WordPress install is in
/var/www/blog
, if not change accordingly.You need to check if php5-fpm(assuming you are using this) actually listen on
127.0.0.1:9000
Most of the time the default socket on Debian/Ubuntu isunix:/var/run/php5-fpm.sock
If you want to be sure what is the socket or change it, take a look at/etc/php5/fpm/pool.d/www.conf
.You can also take a look at this answer
Please note that in this answer configs are missing
?$args
after index.php and this important for plugins like WooCommerce - they wont work properly without it.If you want to be sure everything is correct, you can export a dump of your database, and then use find and replace with some text editor the old url with the new one.