How to connect node server via apache? - node.js

We have angular application running in apache and jboss servers in CSR approach. Now we are moving to SSR approach to implement SEO.
So we are trying like request should go to Apache then redirect to nodejs and then jboss.
In box1, apache has been installed.
In box2, nodejs and jboss has been installed.
I have tried like proxypass /node http://:/node. But it is throwing proxy error "The proxy server received an invalid response from an upstream server."
Aapche version : 2.4
node : v11.5.0
npm : 6.4.1
Angular CLI: 6.1.5
Much appreciate if anyone could help us.
Suggest if any other approach is there to implement SEO.
PS: we can't replace apache and jboss with other servers.

If you just need SEO, try to use prerender. It also has solutions for apache and much more

Related

How to launch Vite-React-App with Nodejs and Apache on Ubuntu?

How to launch Vite-React-App with Nodejs and Apache on Ubuntu?
The thing I ended is just a nodejs apache reverse proxy.
But how you bring in all the frontend stuff from react?

Installing Node Application on a server. Apache npm pm2

I have installed a node js application (myapp.js) on a server with a particular IP.
I have npm installed and started the application
I have done this before but it was with apache and much more complex.
However this is the only application on this server. It is running fine.
Shouldn't this just be available at the ip it is installed on?
My own guess is it is something to do with the node setup within the application, as its referring to a local host 8050? Maybe this needs to be an IP?
Edit
I have just installed the application on the server. I havent set up any apache so maybe that is the issue. I think perhaps because i defined a port within the application it then needs a port specified on the server?
Your node application could be accessed locally from:
http://localhost:8050/
And from outside at:
http://youripaddress:8050/
Assuming that port 8050 is open, naturally.
You can also setup a reverse proxy with apache or nginx (or anything else) to proxy your application.

Redirect a url to a local server

Is there any way to redirect a url to a local server?
Like http://example.com/1.js to http://localhost/1.js, without changing hosts file, using node js.
To configure apache on windows, refer this link proxy on windows
To configure apache on UBUNTU, refer this links
Apache2 reverse proxies
Apache proxy on ubuntu
In below code,
if i visit localhost/http-bind. it will hit localhost:5280/http-bind/
ProxyPass /http-bind http://localhost:5280/http-bind/

403 Forbidden after successfully installing Ghost

I have been spending days figuring out how to install the viral Ghost platform, and experienced numerous errors. Luckily, I have managed to install it - Ghost gives me a positive Ghost is running... message in SSH after I've done npm start --production. However, when I browse to my website - http://nick-s.se - Apache displays its default page and when I go to the ghost login area - /ghost, the site returns a 403 Forbidden.
P.S. I have specifically installed Ghost on a different port than the one Apache is running on. I don't know what's going on...
Update - I have found out that I can access my Ghost installation by adding the port number 2368 which I've configured in the config.js. Now, however my problem is - how can I run Ghost without using such ports?...
tell your browser you want to connect to the port Ghost is running on: http://nick-s.se:2368
So a few things, based on visiting:
1) It seems Apache isn't proxying the request onward to Ghost. Are you sure that you've configured it properly?
2) It also looks like Apache doesn't have access to the directory that you set as root. This shouldn't be necessary anyway if proxying is set up correctly, but could become an issue later if you wanted to use apache to serve things like the static assets.
If you are open to nginx instead of Apache, I have written a how to on this: link. You can skip the section on configuring Nginx. Otherwise, still might be useful if you figure out the conversion of rules from Nginx to Apache.
If you don't have any other sites running on your VPS you can just turn apache off and not have to deal with apache proxying the request to port 2368 and have Ghost run on port 80. If your VPS is running CentOS you can check out this how to on disabling apache and running Ghost on port 80.

Deploying WAR file in Amazon AWS - Tomcat and Apache HTTP Server conflict

I'm using an Amazon Linux AMI instance and I've deployed a war file on it.
The deployed war file shows up in the 'webapps' folder of tomcat6.
The real problem is - Apache HTTP 2.2 server is also installed.
When I access my instance's URL (http://ec2-107-20-92-32.compute-1.amazonaws.com), I see the default page of Apache HTTP 2.2 Only, which, if I'm not wrong, works on port number 80.
Now, how do I get my Apache HTTP 2.2 Server communicate with tomcat6 to display the website deployed in Tomcat?
Or, are there any other alternatives to it?
(I use MacOS X's terminal to connect to my Instance and I uploaded the WAR on S3 to deploy it in tomcat.)
TIA :)
In addition to mac's suggestions (shutting down Apache and making Tomcat listen at port 80, or configuring the Tomcat connector on Apache), you might also set a pair of ProxyPass/ProxyPassReverse directives on your Apache configuration, like the example at mod_proxy documentation.
If you decide to follow this suggestion, your rules would look like follows (in the VirtualHost listening at port 80):
ProxyPass / http://ec2-107-20-92-32.compute-1.amazonaws.com:8080/
ProxyPassReverse / http://ec2-107-20-92-32.compute-1.amazonaws.com:8080/
Nothing worked.
I deleted the instance and tried the same with Ubuntu 12.04 64 bit instance, it worked.
I have no clue why it didnt work in Amazon Linux AMI :(

Resources