SSL via different domain & path with NGINX/PHP-FPM
-
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:
* https:// blogdomainx.com/
* https:// blogdomainy.com/
* https:// blogdomainz.com/each of which lives in /srv/(folder) so:
* /srv/blogdomainx.com
* /srv/blogdomainy.com
* /srv/blogdomainz.comand 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-adminwhere 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/mylinodehostI’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 https://wordpress.stackexchange.com/questions/38902/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 https://www.ads-software.com/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, "\231\3SELECT t.*, tt.* FROM wp_te"..., 157) = 157 read(4, "\1\1\n?\2\3def\22myblogdb_wp"..., 16384) = 763 poll([{fd=4, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout) write(4, "\230\3SELECT t.*, tt.* FROM wp_te"..., 156) = 156 read(4, "\1\1\n?\2\3def\22myblogdb_wp"..., 16384) = 763 poll([{fd=4, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout) write(4, "\230\3SELECT t.*, tt.* FROM wp_te"..., 156) = 156 read(4, "\1\1\n?\2\3def\22myblogdb_wp"..., 16384) = 763 poll([{fd=4, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout) write(4, "\205\3SELECT t.*, tt.* FROM wp_te"..., 137) = 137 read(4, "\1\1\n?\2\3def\22myblogdb_wp"..., 16384) = 763 poll([{fd=4, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout) write(4, "\177\3SELECT * FROM wp_posts WHE"..., 131) = 131 read(4, "\1\1\27<\2\3def\22myblogdb_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.
- The topic ‘SSL via different domain & path with NGINX/PHP-FPM’ is closed to new replies.