rejetto forum

Software => HFS ~ HTTP File Server => router & port problems => Topic started by: iBars on March 28, 2016, 02:45:32 PM

Title: How to run Apache and HTTPFileServer both on port 80?
Post by: iBars on March 28, 2016, 02:45:32 PM
I would to run Apache to host my web-sites (accessible via their domains, eg.: site.com) and HTTPFileServer (accessible via host machine IP-address, eg.: 95.31.41.51) but all of them on port 80. How to do it? Big thanks
Title: Re: How to run Apache and HTTPFileServer both on port 80?
Post by: bmartino1 on March 29, 2016, 01:35:24 PM
https://community.apachefriends.org/viewforum.php?f=16

here are specf forums for apache in and of itself, to change the port number you have to edit the htdoc and change it in the config

Choose a free port number. Take a look to all your used ports with Netstat (integrated to XAMPP). ...
Edit the file " http.conf " ...
Edit the file " http-ssl.conf " ...

see also:
https://httpd.apache.org/docs/2.4/ssl/ssl_howto.html

http://stackoverflow.com/questions/3940909/configure-apache-to-listen-on-port-other-than-80

http://stackoverflow.com/questions/11294812/how-to-change-xampp-apache-server-port
Title: Re: How to run Apache and HTTPFileServer both on port 80?
Post by: rejetto on March 30, 2016, 01:15:54 AM
@bmartino1, he stated "all of them on port 80".

In the generic case the answer is just "you can't", because you can have only 1 software listening on 1 port of 1 network interface (so you must vary the port or the network interface).

In your case it is actually possible, as Apache has a module to work as a proxy, and resend to others only specific requests.
So, what you have to do is actually to have only Apache on that port of that network interface. Put HFS somewhere else, like a different port for example, and configure Apache to route some requests. I'm not an Apache expert and this is not an Apache forum, but I actually use this feature and i can tell you that you should put in your httpd.conf something like this

ProxyPassMatch DESCRIPTION_OF_REQUESTS_TO_ROUTE http://ADDRESS_OF_YOUR_HFS

If i'm not wrong, if you want to route requests based on the domain, your "description_or_request" should actually be ALL of them, but put inside the block of the domain configuration. If you have your HFS on port 81 of the same computer, you can route requests to http://127.0.0.1:81

In case you have further difficulties and can't get a good answer here, consider to seek help on specific forums.
Title: Re: How to run Apache and HTTPFileServer both on port 80?
Post by: bmartino1 on March 31, 2016, 01:12:42 PM
@Rejetto,

Yes, i saw that, but i disregarded that as the user didn't post any info on using hfs, appace vitural host would allow him to do that, and a default with list view on appache is a httpfiel server, so i disreagard that info... i could have said, only one program to a single port, but his question was more on how to set it up....
Title: Re: How to run Apache and HTTPFileServer both on port 80?
Post by: MarkV on April 02, 2016, 04:55:29 AM
One problem is semantics here. You can technically run many applications on port 80 if you want, but you can't run more than one per socket. Network applications listen on sockets, not ports.

In Windows, you can apply multiple IPs to one NIC. So you can run one process per IP+port (=socket). If you apply IPs 192.168.0.10 and 192.168.0.11 to the NIC, you can run Apache on 192.168.0.10:80 and HFS on 192.168.0.11:80.

Sadly, there is one major blocking issue: Anyone behind a router can only forward each port once - to one dedicated target IP. Forwarding the same port to multiple IPs would be ambiguous.
So the Apache Forward/Reverse Proxy thing is still the best solution.

Disclaimer: IPv6 ought to solve all of this by restoring the network end-to-end principle.