I have a web domain running in my local, say test.com using apache pointing to a node server port, ie 4000
Now I wanted to set up another sub domain, say subdomain.test.com in the same box using a different node port.
Right now, test.com is working in the way like, hitting apache first and redirecting to node server using a redirect rule entry in the hpptd-proxy.conf like below
ProxyPass / http://localhost:4000/
ProxyPassReverse / http://localhost:4000/
Please let me know if any one has any idea on the above issue.
Thanks in advance,
How about using virtualhost for redirect process
<VirtualHost subdomain.test.com:80>
ProxyPass / http://localhost:5000/
ProxyPassReverse / http://localhost:5000/
</VirtualHost>
<VirtualHost test.com:80>
ProxyPass / http://localhost:4000/
ProxyPassReverse / http://localhost:4000/
</VirtualHost>
Related
Here is what I want to implement on DigitalOcean. It uses Apache2 server.
enter image description here
As result, it means https://api.server.com/webhook → http://localhost:3002/webhook on Node server.
Please guide me how to implement.
Thank you in advance.
I made a domain conf file in etc/apache2/sites-available, and then I enabled it.
<VirtualHost *:443>
ProxyPreserveHost On
# Servers to proxy the connection, or;
# List of application servers:
# Usage:
# ProxyPass / http://[IP Addr.]:[port]/
# ProxyPassReverse / http://[IP Addr.]:[port]/
# Example:
ProxyPass / http://localhost:3002/
ProxyPassReverse / http://localhost:3002/
ServerName astechbot.com.tr
</VirtualHost>
And I sent the request to domain, but it's not redirected to localhost:3002 (node server).
What is the solution?
I referred the below link and configured the proxy.
https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html
When I configure a proxy for a single application as below in Apache 2.4 in the httpd.conf file, the proxy configuration is working fine. I am able to access my application through the proxy server URL.
ProxyPass / http://host1:8888/
ProxyPassReverse / http://host1:8888/
However If I try configure for two application like below, I am not able to access any of the application.
ProxyPass /nifi http://host1:8888/
ProxyPassReverse /nifi http://host1:8888/
ProxyPass /kibana http://host2:5601/
ProxyPassReverse /kibana http://host2:5601/
Not knowing how you try to reach the application makes it difficult to guess what's might be wrong.
I suggest you to change the proxies config as following:
ProxyPass /nifi/ http://host1:8888/
ProxyPassReverse /nifi/ http://host1:8888/
ProxyPass /kibana/ http://host2:5601/
ProxyPassReverse /kibana/ http://host2:5601/
then try to reach the endpoint pointing your browser to http://youdomain/nifi/ and http://youdomain/kibana/ and check the logs for errors.
My question is probably trivial and a duplicate, but either I cannot formulate it or it's not been answered on SO yet.
I have two webservers on a Digital Ocean droplet. One is listening on port 80 and can be accessed via example.com (DNS are on route 53), and the other is on port 8080: how can I make it accessible from example-2.com?
I suppose the software I'm looking for would intercept the HTTP requests, check the referrer, and route those coming from example.com to port 80 and those coming from example-2.com to port 8080. What is it?
This can not be done using only DNS. By default web browsers attempt to connect to port 80 when the url starts with "http" without specifying a port. The user would have to know to connect to port 8080 and explicitly access the URL as
http://example-2.com:8080
I am assuming you are running both web server instances on the same OS environment/IP address, though this would also work for separate hosting environments. What you probably want is a reverse web proxy which can inspect the requested domain name and route to an appropriate server instance. You would run the reverse web proxy on port 80, and probably move the server you are currently running on port 80 to another port (say, 8081).
Apache with mod_proxy and the virtual hosting settings is a possible solution. Assuming example.com and example-2.com point to the Apache instance configure it something like this:
<VirtualHost *:80>
ServerName example.com
ServerAdmin webmaster#example.com
ProxyRequests off
ProxyPreserveHost on
ProxyPass / http://localhost:8081/
ProxyPassReverse / http://localhost:8081/
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
</VirtualHost>
<VirtualHost *:80>
ServerName example-2.com
ServerAdmin webmaster#example-2.com
ProxyRequests off
ProxyPreserveHost on
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
</VirtualHost>
I currently have a website running under apache on my VPS, but i'm planning to run another website with NodeJS.
Since apache runs on port 80 and NodeJS on port 3000 i was wondering how i could manage that when someone type the domain name domain.com, it binds to the port 3000 ?
Also, is it possible that after the redirect on the browser it shows only http://domain.com and not http://domain.com:3000 ?
Use ProxyPass:
<VirtualHost *:80>
ServerName domain.com
ProxyRequests Off
ProxyPass / http://domain.com:3000/
ProxyPassReverse / http://domain.com:3000/
</VirtualHost>
Actually I'm running this with Apache as reverse proxy in front of CouchDB:
<VirtualHost *:80>
ServerName abc.com
ServerAlias www.abc.com
ProxyPass /abc http://localhost:5984/abc
ProxyPassReverse /abc http://localhost:5984/abc
ProxyPass /_session http://localhost:5984/_session
ProxyPassReverse /_session http://localhost:5984/_session
ProxyPass / http://localhost:5984/abc/_design/tt/_rewrite/
ProxyPassReverse / http://localhost:5984/abc/_design/tt/_rewrite/
</VirtualHost>
Is that possible to setup [vhosts] inside CouchDB itself to run it without Apache reverse proxy at front?
vhosts work with the Host HTTP header for routing primarilly.
Combine that with rewrite rules (they are part of design documents) to accomplish what you are seeking to do.