I am creating a website, which will have two subdomains: texts.example.org and users.example.org
texts.example.org is written in PHP on Apache.
users.example.org is written with express.js.
On a normal server, this is fine. However, I want to be able to run this on my local machine (Windows 10) as well.
I setup subdomains in .../etc/hosts:
127.0.0.1 texts.localhost.local
127.0.0.1 users.localhost.local
However, I can't have both Apache and Express.js listening to the same port. How do I tell Apache to only respond to requests for texts.localhost.local, and tell Express to only respond to requests.localhost.local, while sharing a port?
Related
My issue is rather simple: How do I configure my setup, so that my WSL (2) instance (ubuntu) could access and use a proxy server served using Burp Suite on the same physical computer, but on the Windows side?
Currently I am getting connection refused, whatever I do. The proxy obviously works fine if I test it in windows.
The proxy is setup to redirect localhost:3001 --> localhost:80. This is where it gets a bit tangly, as the localhost:80 server is in fact running on the WSL instance too.
So basically, I would like a program, FFUF in this case, on WSL to be able to send a request through my Burp Proxy which is on Windows. The proxy then redirects the request back to WSL to the apache2 server that is running there.
WSL (FFUF) --> Windows (Burp proxy) --> WSL (Apache at :80)
I believe there is something I am missing regarding localhost and what is localhost in what case.
localhost from Windows seems to work to reference services running on WSL, but I am not sure it works the other way around...
I have tried using localhost, 127.0.0.1, and the LAN IP of Windows as mentioned in the virtual WSL network. No luck from WSL side yet.
My apache is setup to listen to 0.0.0.0:80
I have a Virtual Machine Linux Debian 10, with two Host-Only Network interfaces actived respectvely 192.168.56.10 and 192.168.56.15 with static ip address.
Apache Tomcat 9 is installed and Apache2 Http Server is installed too.
My purpose is that Apache Tomcat 9 must run on 192.168.56.15:8080,
while Apache2 Http Server must run on 192.168.56.10:80.
The /etc/hosts file in my Linux is:
#
192.168.56.10 www.example.com
192.168.56.15 openam.example.com
#
The C:\Windows\System32\drivers\etc\hosts is the same.
In short I'm trying to setup a small development enviroment for Identity and Access Managment using the Forgerock's AM solution. That software has to be deployed as a .war file (openam.war) in Tomcat /webapps and it will be mapped as openam.example.com, and I want this service run on
192.168.56.15:8080/openam;
So my problem is that I want two different services responding two different interfaces but running on the same Virtual machine.
I want that only if i type 192.168.56.15:8080 or openam.example.com:8080 I recive a respond from Tomcat, but if I type 192.168.56.15:80 or openam.example.com:80 Apache Http Server doesn't have to respond. Apache Http Server have to respond only on 192.168.56.10:80 or www.example.com.
In this way I can have like two different machines one with the web server and one with the application server, responding on two different IP addresses and hostname, but running on the same machine.
Thanks for help!
You could have 2 IPs but what's the point in doing so?
I find it rather pointless to have 2 separate IPs for 2 different services on the same machine (e.g tomcat on 1 / HTTP server on the other) for a development environment inside a VM. Port handling will be handled by the operating system itself and route the request to the open port.
Keep in mind that browsers will try to connect http:// calls on port 80 by default - so unless you type 8080 into the URL the browser it is just going to use port 80.
If you do not want calls to openam.example.com to come in on port 80, the simplest way round it is to use a htaccess rule that implements a rewrite for any request that contains openam.example.com (or just anything in a subdomain portion) on port 80 to be rewritten to the appropriate URL.
I have followd this answer https://serverfault.com/a/249582 to enable proxy and put a line to forward internet operations. However, since I use http://localhost to browse my website, it also redirected localhost to the proxy server and thus my website cannot even load.
How can I bypass local addresses such as localhost, 127.0.0.1 or internal network IP such as 192.168.1.50, such that fopensock can work normally?
I've got a web app running on localhost:3000. I also have an apache server. I would like to reverse proxy the apache server so that requests to /mywebapp get forwarded to the server running on localhost:3000.
I currently have the following config at the bottom of my httpd.conf file, but I'm getting a server error when I try to access it:
ProxyPass /mywebapp http://localhost:3000
ProxyPassReverse /mywebapp http://localhost:3000
Edit - further details:
I'm running a jetty server with java -jar myapp.jar. I'd like to forward requests to an apache server listening on :80 to the jetty server.
I've got mod_proxy_http.so and mod_proxy.so enabled.
I can tell the server is running on localhost - it responds to curl with the appropriate http response. So I'm pretty sure the issue is with my apache setup, but I can't think what the problem would be.
Apache conf file in conf.d for reference: http://pastebin.com/vhXwjbQe
And I've got this in my httpd.conf:
Include conf.d/*.conf
It's hard to give a generic answer because every situation is different so here are some debugging questions to ask yourself:
if the protocol and port correct on the internal service, http and 3000.
Is the service actually listening for connections from localhost? is it running in a docker container etc that would require it to be listening on a different interface? You can check for this by looking at the output from mywebapp's logs and see if the request are making it through the proxy.
Do the paths on the internal service include the prefix that is being passed to Apache or does apache need to strip these off. if for instance mywebapp expects the path "/foo/bar" and apache's reverse proxy is sending it with the context path included "/mywebapp/foo/bar" then it will not match any path in mywebapp.
I am using node.js server and implemented socket.io.
It works fine, but for some reason, I have to use Apache Tomcat, running on port 8080, and the node server running on 8081.
If I run the application via :8081 (serving pages through node.js), socket.io (socket.io is listening to 8081 port) is working, but when I serve through Apache Tomcat running application via :8080/Demo_Pro/index.html, socket.io is not working.
Can anybody explain how to run both Apache Tomcat and node.js at the same time.
You should look on google on how to host node.js and apache at the same time. You'll find that you'll have to use mod_proxy to proxy requests through apache. (node.js needs to be on another port). Look at this link: how to put nodejs and apache in the same port 80. It'll give you an idea on how to do it.