SSL via different domain & path with NGINX/PHP-FPM/WP

I am going to be hosting several WordPress blogs. They are all going to have their own domains. I want to handle their administrative functions via SSL but I do no want to buy an SSL certificate for each of them, since the only thing on them using SSL will be the admin page. I want to have the following configuration instead:

  • http:// blogdomainx.com/
  • http:// blogdomainy.com/
  • http:// blogdomainz.com/

each of which lives in /srv/(folder) so:

Read More
  • /srv/blogdomainx.com
  • /srv/blogdomainy.com
  • /srv/blogdomainz.com

and I would like to admin them via https on mylinode.mydomain.com via these urls:

  • https:// mylinodehost.mydomain.com/blogdomainx/wp-admin
  • https:// mylinodehost.mydomain.com/blogdomainy/wp-admin
  • https:// mylinodehost.mydomain.com/blogdomainz/wp-admin

where mylinodehost.mydomain.com has an actual SSL certificate and is configured to use SSL already (for nginx as well as a few other services it runs). It is hosted in:
/srv/mylinodehost

I’ve tried accomplishing this by symlinking:

ln -s /srv/blogdomainx /srv/mylinodehost/blogdomainx

as well as via locations in the nginx.conf file. The admin pages always seem to work, but the root of the site (which I need to be able to see via https on that same domain for some administrative functions) is always in this zombie state where it displays a wordpress-generated (themed and everything) 404. I’ve tried following the directions on Use a different domain for SSL from TheDeadMedic, and that got me closer – the themes render properly but I still get a 404. I also don’t even really understand why WordPress is handling the 404 when I have a directive telling nginx that the 404 should be a static HTML page. I’ve also tried the http://wordpress.org/extend/plugins/wordpress-https/ plugin with the same results as using the method TheDeadMedic suggested.

Diving in further, I find the following in the strace on php-fpm:

poll([{fd=4, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
write(4, "2313SELECT t.*, tt.* FROM wp_te"..., 157) = 157
read(4, "11n?23def22myblogdb_wp"..., 16384) = 763
poll([{fd=4, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
write(4, "2303SELECT t.*, tt.* FROM wp_te"..., 156) = 156
read(4, "11n?23def22myblogdb_wp"..., 16384) = 763
poll([{fd=4, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
write(4, "2303SELECT t.*, tt.* FROM wp_te"..., 156) = 156
read(4, "11n?23def22myblogdb_wp"..., 16384) = 763
poll([{fd=4, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
write(4, "2053SELECT t.*, tt.* FROM wp_te"..., 137) = 137
read(4, "11n?23def22myblogdb_wp"..., 16384) = 763
poll([{fd=4, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
write(4, "1773SELECT * FROM wp_posts  WHE"..., 131) = 131
read(4, "1127<23def22myblogdb_wp"..., 16384) = 3055

Shortly after that, it writes a 404 to the web server. To me it seems like a MySQL timeout but why would mysql timeout on one site and not another, on the same box in the same nginx process and mysql process?

Is this a fools errand? I can buy an SSL cert (or put on a self signed) for this blog domain but I was planning on doing this for several others and so I’d really like to get this working under the one domain.

Any help would be much appreciated, and let me know if I can provide additional information that might be helpful.

Related posts

Leave a Reply