I’ve just installed Ghost 1.0 and updated to the latest 2.0; clean install so far and all is working well.
I was using WordPress before, but I want to switch. I’d like to be able to temporarily upload my old WordPress installation to a subdirectory like domain.com/myoldsite/ and have it run from there while I work on transposing the design and content.
The question is, how? I’ve created the subdirectory in /ghost/system/nginx-root/oldsite (as that nginx root is where the domain resolves from) but I think I’m being naive. I believe I have to configure the nginx conf in such a way that the /oldsite/ route is handled by PHP rather then Ghost (it now just shows a 404 page). But how? What? Where?
I’m pretty confident in LEMP server setups, but I’m not sure how Ghost’s installation fits into here.
You need to configure your nginx config (which is going to be located in /etc/nginx/sites-enabled/domain-com.conf (or something similar)) to proxy requests to /old to WordPress. Here are some useful snippets from the WordPress docs:
location / {
# This is cool because no php is touched for static content.
# include the "?$args" part so non-default permalinks doesn't break when using query string
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass php;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}
Thanks for the quick reply
I figured it would be something like you said, but whatever I try it doesn’t seem to take; even if I purposely break the mapping it still shows the 404 (and yes I do restart Nginx after each change).
This is what I have now for location blocks in my server block;
So I’ve (also) tried the /index.php?$args with and without forward slash; no cigar…
Edit: Also; I copied these blocks from other WordPress-configurations I have running on the same server without trouble.
It’s a Ghost 404 (that’s so strange to me), and yes the folder exists; /var/www/ghost/system/nginx-root/oldsite/ is the absolute path.
In that folder is the old /www/ directory, so if it would load via PHP it should give back some Database connection error as I haven’t set up the database for it yet.
If you’re getting a Ghost 404, that means the hierarchy of location blocks isn’t working. This means if you [temporarily] comment out the location / { } block, /oldsite should work. If that’s the case check out this article for info about fixing that. I don’t want to give you advice with that since I myself get confused quite a bit :)
Your remark about the hierarchy of location blocks made me think about the hierarchy of the configurations… I realized that I was editing the default conf whilst using SSL, so I should edit the *-ssl.conf
So I did, put the /oldsite/ block above the regular one, and now I get a Forbidden page; so it seems to be working so far
Consider my question answered!
TL;DR: I edited the location blocks in the wrong file; using SSL? edit the SSL conf file in sites-enabled/
Maybe I was celebrating too soon; that 403 Forbidden page won’t go away with even the right owner and chmod 777. Is there maybe some other part of Ghost config that might interfere with this?
Edit: Again, pretty simple. Adding the correct indexes to the location block did the trick.
Edit2: Ha. It seems that Ghost hijacks a wp-admin link and redirects it to /ghost… Next battle…