Lets us consider a case, there are 2 apache server running, and one domain is available.
if we make a request like this, http://domain1.com/example1.php it should request one
apache server where actual domain is present. When http://domain1:8000/example1.php it should point to a application in a another server (other machine) under a same domain group.
Now a question is, if http://domain1:8000/example1.php is requested, then it will run in which server? which server will interpret it? which server will execute those files, either apache server in domain1 system or, a apache server that domain1:8000 (this is other machine, to which request is port forwarded) points?
A server will listen on a specific port, so if you are using different ports, it will go to whatever server is listening on that port, regardless of the domain.
Since you're using port forwarding, then it can only be processed by where ever you forward the ports to. So, port 80 is being forwarded to your main server and port 8000 to the other server. If you didn't forward, and all were going to the first server, then you would get an error if the first server were not also listening on port 8000.
Related
I am new to php and I would like to run a local testing server using easy php at home to work on school projects but when I try to start the easy php server, this error message pops up: Apache port (80) is already used by another application ! Close this application and try to run again the server It then gives me some instructions on how to close the application (by killing processes of selected ports), but when I right on the selected ports, the kill processes option is faded and not clickable. Maybe there something else I need to check or do on my computer to run this local host? Thanks for all help!
Just a shot in the dark but maybe try to close Skype, if you have that running, and then start the server? If I remember correctly Skype listens on port 80 by default. If that's indeed the issue then you can configure Skype not to listen on port 80 in its settings...
That might be related to Skype or the IIS server using port 80. You can configure Skype to use different ports in the preferences. You might try going to "localhost" in your browser and see what comes up as well. If it shows a Microsoft IIS server page then you know that the server is running. Disabling that or turning that off depends upon your operating system. You can probably just look that up on the internet if that is the issue.
I'm running XAMPP on Windows and know that I could set up a proxy server by adding a few lines in httpd.conf and httpd-proxy.conf, but I wonder if there's a way to set up a proxy server that runs behind another proxy server, since my ISP cache files from some websites and I usually don't get the up-to-date data.
I have a application in nodejs and PHP. For now i am using different both.
Can i run node and apache both on same port 8080
Is, there is any way to run any application both on 8080
Thanks
An port is usually connected only to one application. So you have to use different ports.
Proxy -
But you could for example create an virtual host in apache and configure this host as proxy. In this configuration you could access the node.js server on the same port. The node.js server would run on another port.
For TCP based applications, no. You can have only one application listening on a single port at time. If you had 2 network cards, you could have one application listen on the first IP and the second one on the second IP, both using port 8080.... but I doubt that is your case.
I guess you can run them on UDP protocol, which could allow you to have two applications listen to the same port, but as UDP is unreliable and it doesn't establish connection, just sends/receives packets. You might experience big packet loss on UDP.
So, short answer - no.
Actually, there might be a way using iptables. Add a rule of this nature
iptables -A INPUT \
-p tcp \
-m bpf --bytecode "14,0 0 0 20,177"
-j redirect .. Port 80
Check the first few bytes of the connection, and redirect the connection. Then you can accept both http and node.js on the same port, but have the servers running on separate ports.
The syntax above is incorrect, and I have not tried it, but I know people who have used this strategy successfully.
I have a php server listening on a port that seems to have issues. How can I connect to the php-cgi server to find out it if it up or not? (Sort of "ping" the php-cgi process)
I need to determine if the issue I'm having is due to the http server or the php-cgi server. Therefor I want to be able to "ping" the php-cgi server to make sure it is accepting requests. If not, I know it is the php-cgi server that is the cause of the problem.
Try to use telnet
telnet localhost portnumber.
So if you running on port 80 of your localhost type in
telnet localhost 80
It should connect if it does not, your server is not running!
I have a problem that is stuck in my mind for almost 24 hours, and at this moment I don't know how to fix it.
Here is the thing: I want to have one 'main' socket on my server that processes all incoming data and sends it to other clients using PHP. That part goes fine, but I want to connect with that socket using multiple subdomains, e.g. ex.example.com. The thing with this is, that you cannot connect with that subdomain unless you have a socket running on it, and that just fills up your ports and that is what I'm trying to prevent.
The best solution is to make Apache process the incoming TCP request, saves the data on which domain you are connecting, and then redirects the client to the main socket, which processes the received data and immediately acts when the client is accepted.
Honestly, I have no idea how to do this. I'm searching for hours, but the only thing I've found was something on Stackoverflow that got close to it: Apache - handling TCP connections, but not HTTP requests
But with that piece of script I am not able to save data (which domain you're using) and send it to the main socket.
I don't know if this can be done by Apache or if it is possible at all, or if there are any other workarounds.
Thank you :)
You are confused about subdomains. Sockets, TCP, and IP all know absolutely nothing about names. DNS wasn't invented until that networking stack had been around for years.
Thus, you can point any number of domains at a single "socket" port on a machine.
Apache can route an incoming request to different "webspaces" (i.e. virtual hosts) based on the destination IP address of the incoming connection(1) or the HTTP/1.1 "Host" header(2). The former was how virtual hosts used to be done but now almost everybody uses the latter.
(1) A machine can have multiple IP addresses even with a single network card but ports are unique to any given protocol on that machine. You point different domains to different addresses and define a reverse-mapping on the webserver so it can tell how the request began.
(2) The value of the "host" is the DNS name that was given to the browser. Since this value is passed explicitly to the webserver, that server doesn't need to rely on tricks like #1.