Integrating node.js and express website with wordpress hosting - node.js

I have a website running on node.js and express, hosted on Amazon EC2 with a normal domain (e.g. www.example.com)
We want to add a blog to the website. We would like the blog route to be www.example.com/blog
I have tried a Ghost installation under node.js (with a proxy layer to handle the port and url remap). I got it working ok, but the feature set is not robust enough for our content creators. They would rather work with WordPress.
But WordPress does not have a node.js install, and I do not have the bandwidth to set up and run a WAMP server in addition to the node.js server we currently use.
So I am investigating using a another hosting option for wordpress and using a proxy layer to redirect to the hosted wordpress blog.
From what I have read online, WordPress hosting will not work (cannot configure the URL properly on the WordPress side). And I could not get the proxy layer to work with a test account.
Will a 3rd party (like GoDaddy) work?
I am envisioning that we host the blog on GoDaddy. And on our site, I set up a proxy to map www.coursehunter.org/blog to the GoDaddy hosted Wordpress blog. Has anyone done this? Does it work technically? I understand I would probably have to edit the .htaccess file.
Are there SEO gotchyas from an implementation perspective? The main point of our blog is to build out content for our main domain which is why we want the www.example.com/blog url.
Thanks!

I would suggest you look into Nginx web server. You can set it up as a reverse proxy for your NodeJS/Express web application and install its php-fpm module to handle the PHP part(Wordpress).
Here is a guide to set up Wordpress with Nginx https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-nginx-on-ubuntu-14-04
And here is one with set up your NodeJS application with Nginx https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-14-04
In your case, you will need to setup the url configuration so that the parts get routed to the correct destination that is NodeJS part is handled by reverse proxy and Wordpress is handled by php-fpm

Related

Is it possible to host Wordpress Blog under route of React App

Is that possible to host a Wordpress Blog under a route in my React Web App?
For example, my React App is running on domain www.myreactapp.com, can I host a Wordpress blog under route www.myreactapp.com/blog.
When I worked with PHP Web APP, it was easy, you just need to create sub-folder named "blog" and install Wordpress in it. I am hoping to get a solution like in PHP Apps, if yes I can just make use of all features of Wordpress with less amount of coding.
Thanks in advance
You cannot do it directly as WordPress have its own configuration which is necessary for WordPress website due to which admin panel will not work, but you can use WordPress API to load the data you wanted from WordPress and show in react app.
I am not sure this is exactly what you wanted or not but you can also setup the WordPress separately in sub domain like http://blog.myreactapp.com
Also let me know if you found any working solution
All,
We can host the Wordpress blog along with React App like in the question(for example www.myreactapp.com/blog).
Steps
Use Nginx to host the React App
Install Wordpress
Add a rule in Nginx to proxy the request to WordPress when the request comes to /blog. http://nginx.org/en/docs/http/ngx_http_proxy_module.html
Hope this helps
Thank you

Wordpress and NodeJS on separate servers with htaccess

I've a 2 servers with the first my website on Wordpress and the second a dedicated server with NodeJS app.
Now on 1° server I've only access to .htaccess and I don't have permission to edit apache config. On this server I've an SSL cert and use it with Wordpress.
I need to have this:
When an use type https://www.example.com/app I want to redirect all requests to my second server nodejs.example.com:3000 without change the url and using same SSL cert.
Can I do that?
That's not possible without having admin access to the server. You'll need to install the apache proxy module apart from editing the configuration.
Ref: Run a NodeJS app with Apache

How to manage sub-domains in node sites

I am creating my first MEAN2 app, but I stuck in mid. My site required one front-end (mysite.com) and one back-end(admin.mysite.com) to manage content. In future I would like to have a unique URL (*.mysite.com) for all the uses who will register at my site, for which there would not be a any directory in real. How could I acchieve it in a best way. To be more clear my requirement is -
mysite.com (original site)
admin.mysite.com (a sub-domain to be managed from same server.js file)
*.mysite.com (based on request host)
Note: I have created site using angular-cli are my structure is like below
-mysite(angular 4 app)
-admin(another angular 4 app)
-server.js
This problem is not specific to node.js. However, in order to setup a domain successfully for your web app, you'll need 2 things:
Web Server
This will manage for you virtual hostnames etc. I would advise you to look at setting up nginx as a reverse proxy in front of your node app.
Domain provider
This will actually allow you to publicly use the domain *.mysite.com. Then you will have to setup a DNS Record, generally an A record, to point at your server IP Address.
This is very high level :) but should be enough to get you started.
EDIT
If you want to test locally just setup nginx with a test server name to proxy_pass to your local nodejs app (i.e. http://localhost:3000) and create a host entry in your hosts file for that hostname.

Apache how to server more apps from same domain based on path?

I have a web app that is composed from 2 apps:
- a simple PHP presentation site that handle account creation
- an API ran by a Tomcat server
I have the apache setup to server at mydomain.com the PHP, but I want to server at mydomain.com/api the Java app that runs on 127.0.0.1:8080.
I know how to do this using api.mydomain.com, but I have single site SSL certificate that does not cover subdomains, this is why I need to do this by path.
Is this possible?
I guess you are looking for a reverse proxy.
See: http://www.linuxjournal.com/content/protect-your-ports-reverse-proxy?page=0,0
Edit: I think below two links are closer to your use case
https://stackoverflow.com/a/1252993/115896
http://blog.lundscape.com/2009/05/configure-a-reverse-proxy-with-apache/

How to run a website in Azure using same URL?

Our company has two sites
www.mysite.com -- Wordpress site
www.mysite.com/portal -- asp.net mvc site
We want to move the wordpress site (www.mysite.com) to Azure and the other site stays local. We need to url stay the same. How can we achieve this?
Since you state that you need the URL to stay the same, this can be achieved through a reverse proxy. You would set up a web server (typically nginx or IIS) answering on www.mysite.com.
This web server would have reverse proxy rules to forward requests for /portal to your on-premises server (in a given, non-public IP and port) and all other requests to another web server running WordPress (on the same server/cluster that runs the reverse proxy, or a separate one), also with a given IP and port.
All user requests, then, would reach the reverse proxy, that would serve them from cache if possible, or forward them to the internal web servers, and send the response back to the user, transparently. Notice that this is an internal operation, not a redirect response.
Although this setup is more complex than the simpler solution of using different subdomains (www.mysite.com for website and portal.mysite.com for application), it comes with certain advantages that are described in the referenced Wikipedia article, such as security and acceleration.
Alternatively you could create separate subdomains as described above, and use a redirect rule to redirect requests for www.mysite.com/portal/x to portal.mysite.com/x. In this case, the user would see the updated URL in their browser, but the old ones would still work.

Resources