Wordpress and NodeJS on separate servers with htaccess - node.js

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

Related

How can i link two NodeJS servers under one domain?

for example i have a website that hosts a messenger app, it's written using Node JS on the back-end and has a server running on an obscure port (port 3455)
Currently my domain is being used to host my portfolio under a different port. the domain would be:
mydomain.com/
Is there anyway i could make it so that the app using port 3455 connects when i visit:
mydomain.com/messengerapp
even better would i be able to create a subdomain so its:
messenger.mydomain.com
You can achieve this by 301 redirection code. If you have apache server, add redirection rule to .htaccess and if you have nginx server, add redirection rule to its config file.

URL Masking in address bar

I have an application in my server for example at www.myDomain.com/pos, my client wants to run this application with his domain name As: www.clienDomain.com/pos.
But i don't want to install my application to client server. is there any way to access my server with clientDomain name?
Yes very possible.
If your client is running Apache, and has mod_proxy installed, most do by default.
Then you can use .htaccess directives like so:
ProxyPassReverse "/pos" "http://example.com/pos"
In addition, reverse proxies can be used simply to bring several servers into the same URL space.
More info here:
https://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass

Integrating node.js and express website with wordpress hosting

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

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/

.htaccess redirection to an IP Address of a different server

I am hosting my public facing site at a shared host (Hostgator) with the domain pointing to the same. I also have my application hosted on a dedicated server with a different host. Both servers have their own SSL certificates installed.
Is there any way to edit the .htaccess file to do the following:
https://www.domain.com/CUSTOMER redirects to https://x.x.x.x/CUSTOMER while the browser still shows www.domain.com/CUSTOMER?
I'm vary of using frames due to the SSL ramifications. My domain registrar is Hostway and they do not offer URL masking/forwarding.
This can be done by making your server act as a proxy. Even if you have no access to the servers configuration you might be lucky that apaches proxy module is loaded: http://httpd.apache.org/docs/2.2/mod/mod_proxy.html
If so you can 'map' the remote site (IP) as if being served by your normal server.
Also apaches rewriting module can make use of that module by using the [P] flag in a RewriteRule.
Be sure you have a copy of that site on the different server, preverally with the same database, so you don't get in trouble with i.e. order numbers or user logins between http and https. The certificate server must be the web server for your SSL provided web content.
Take a look here foor further informations. "Google Search Result"

Resources