I'm currently hosting a node app on Elastic Beanstalk. Also, I have a wordpress.com blog. For SEO reasons I want to serve the blog from mysite.com/blog
. I could accomplish this through hosting everything on one server fronted by nginx with appropriate rewrite rules. Is there a way I can proxy /blog
traffic to the wordpress site and/or a self-hosted wordpress instance and thus keep my EB setup? Any other elegant solutions?

- 1,124
- 11
- 16
2 Answers
First: I doubt you will be able to proxy traffic back to your WordPress site while it is hosted on WordPress.com, so you probably will have to setup your own self hosted WordPress install or use a managed WordPress hosting company.
Second: You can absolutely setup a server, with NGINX and WordPress installed. NGINX would send any requests for the /blog
location to php-fpm or whatever php processor you use. Everything else can be proxied to EB.
Your config would probably look something like this:
server {
listen 443 default;
listen [::]:443;
server_name foo;
root /path/to/www/;
index index.php ...;
... ssl and other stuff ...
proxy_pass ... to EB by default ...
location /blog {
... use php ...
}
}

- 2,331
- 1
- 25
- 26
-
This got me on the right track, but I wouldn't want all traffic to pass through the blog machine as you've suggested. It's possible to configure nginx on Elastic Beanstalk to proxy to a self-hosted wordpress blog. – Joe Abrams May 10 '16 at 15:54
-
I am sure there is a way to add a configuration to the nginx on EB... which would be something like `location /blog { proxy_pass https://myblogserver; }`. See: http://stackoverflow.com/questions/23709841/how-to-change-nginx-config-in-amazon-elastic-beanstalk-running-a-docker-instance – edhurtig May 10 '16 at 19:14
I solved this problem by setting up a self-hosted wordpress instance and then updating my Elastic Beanstalk nginx configuration to reverse-proxy to it. I had to add this line to the configuration, within the server
section
location /blog {
proxy_pass http://my_blog_address/blog
}
To get this into the config file in a repeatable way, requires some hacking. The easiest way I found was based on this SO question. Basically, you add a hook to alter the config file during EB initialization.

- 1
- 1

- 1,124
- 11
- 16