rejetto forum

How to run Apache and HTTPFileServer both on port 80?

iBars · 5 · 9044

0 Members and 1 Guest are viewing this topic.

Offline iBars

  • Occasional poster
  • *
    • Posts: 1
    • View Profile
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


Offline bmartino1

  • Tireless poster
  • ****
    • Posts: 910
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
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
Files I have snagged and share can be found on my google drive:

https://drive.google.com/drive/folders/1qb4INX2pzsjmMT06YEIQk9Nv5jMu33tC?usp=sharing


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
@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.


Offline bmartino1

  • Tireless poster
  • ****
    • Posts: 910
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
@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....
Files I have snagged and share can be found on my google drive:

https://drive.google.com/drive/folders/1qb4INX2pzsjmMT06YEIQk9Nv5jMu33tC?usp=sharing


Offline MarkV

  • Tireless poster
  • ****
    • Posts: 764
    • View Profile
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.
http://worldipv6launch.org - The world is different now.