1

So, I'm setting up a wordpress site on Digital Ocean's IaaS. I'm using nginx as a proxy and web server (instead of apache), so a LEMP stack. I was able to get my site up and running, though there are a couple of issues. First let me explain my setup more.

Setup

I have nginx set up to redirect a subdomain to a specific directory /usr/share/nginx/www. A request with no subdomain will proxy to a Node.js app listening on port 8000.

Under the usr/share/nginx/www directory I have:

  • 50x.html
  • index.html
  • info.php
  • wordpress/

Under the wordpress directory I have installed wordpress. So, I access my wordpress site through http://subdomain.mydomain.com/wordpress.

I am using php5-fpm and mysql-server installed using apt-get, on a Debian 7 VPS machine.

It works, and I'm able to view my wordpress site. However, here are the issues I'm having:

Permalinks Settings

Permalinks don't work when I set it to the Post Name structure. When I access, /wordpress/some-page I get the /usr/share/nginx/www/index.html file sent to me.

Editing Images (Fixed)

I cannot edit an image in the Media admin panel. When I go to edit an image, I get a broken image in the editor. I also get a message in my browser's JS console saying: Resource interpreted as Image but transferred with MIME type text/html: "http://subdomain.mydomain.me/wordpress/wp-admin/admin-ajax.php?action=imgedit-preview&_ajax_nonce=b25651da4f&postid=117&rand=34418".

Solution: run apt-get install php5-gd

Fixed this issue by installing php5-gd. Apparently this was missing and is a dependency for WordPress. It's unfortunate that I had to find this out by digging through source code, rather than reading it in the tutorial and documentation that I've been using as a guide. Notice that there is no mention of needing php5-gd here: http://codex.wordpress.org/Installing_WordPress

Final Notes

There may be more issues that I'll run into, because I just set this site up.

I'm assuming all my issues involve some kind of configuration with either, WordPress, PHP, or nginx.

3
  • Here's another question from today by @kaiser, about a similar issue.
    – birgire
    Jan 6, 2015 at 20:26
  • @birgire I fixed the image issue after much digging of the source code. Tracking down the problem lead me to a function in the WP codebase that is suppose to use a library (such as GD or ImageMagick) to get an image resource. Installing php5-gd on my Debian server solved this problem.
    – Sam
    Jan 6, 2015 at 23:19
  • Glad to hear you were able to fix this. You should consider adding your solution as an answer and accept it, to close the question. Every registered user of wordpress.org can edit the Codex pages, so it's an opportunity there for you ;-)
    – birgire
    Jan 7, 2015 at 9:19

1 Answer 1

1

Your Nginx website conf should look like that:

location /wordpress {
    try_files $uri $uri/ /wordpress/index.php?$args;
}

This will allow all paths who doesn't match a real file to be redirected to the index.php with the query sting passed directly to Wordpress. Wordpress will handle it from there.

More in depth information can be found here: http://wiki.nginx.org/WordPress

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.