Ghost Install on DirectAdmin VPS -- Upload works, Put/Delete fails, uses vhosts on nginx [SOLVED]

Hi everyone,
I am a recent convert from Wordpress. Ghost works fine on my local. I have a “successful” install to my staging site, but am running into some interesting behavior. Here’s some context behind it:

What version of Ghost are you using?
4.x (latest, fresh install from last night)

What configuration?

  • I’m running Debian 9 with DirectAdmin handling the nginx stuff. (Nonstandard stack, yes.)
  • I wrote my own server block for ghost in the conf file per DirectAdmin’s way of handling nginx, using vhosts
    - It works: the site loads. (Hope this is useful for anyone who wants Ghost to get along with DirectAdmin)
  • I can also upload json data from my local into staging for migration.
  • But it looks like I can’t put/delete anything!

What errors or information do you see in the console?

  • When I try to delete the default ghost user, it says “This user could not be deleted.” When I try to edit a post, “server was unreachable.” I don’t see a response on my Network tab, from any of my put / delete requests.

I have tried:

  • checking the sizes of php-fpm and nginx. They are quite large (more than 10MB) and I’m not migrating anything; in fact, my migration went alright – the posts entered the database.
  • I am ruling out “permissions” as the ghost-cli will have corrected me pre-install to set files to the correct octal value.
  • What I am asking is, could this be due to nginx server block configuration? I followed the “base” config" and the site loads, so I assume some of my routing was correct.

Here’s what I based my nginx block off of:

server {
    listen 0.0.0.0:80;
    server_name *your-domain-name*;
    access_log /var/log/nginx/*your-domain-name*.log;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header HOST $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://127.0.0.1:2368;
        proxy_redirect off;
    }
}
``


Directadmin uses vhosts (virtual hosts) to handle nginx configurations. When I installed ghost, I skipped the nginx configuration knowing that I could just "point" nginx to the correct folder. Perhaps there's a config somewhere I missed out? Any advice would be greatly appreciated, and I notice that Directadmin installs with Ghost are rare. I think this is useful for others down the line.

Thanks in advance for checking my thread :)
  • Continued testing today. Attempted http methods delete, didn’t work. post/get worked fine.
  • Concluded that it was due to http methods. Double checked nginx, sure enough, they don’t allow delete etc. by default.
  • Enabled it through rewriting confs from directadmin site. Here is the resource: Enabling PUT and DELETE methods in apache/nginx

Conclusion:
two things to configure for when installing ghost with directadmin:

  1. nginx.conf for the user that installed directadmin to set up “proxies”
  2. ensure nginx will accept delete/put/patch, etc. rewrite confs as needed. cheers.