Author Topic: How to run Apache and HTTPFileServer both on port 80?  (Read 1993 times)

0 Members and 1 Guest are viewing this topic.

Offline iBars

  • Occasional poster
  • *
  • Posts: 1
    • View Profile
How to run Apache and HTTPFileServer both on port 80?
« on: March 28, 2016, 08:45:32 AM »
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

  • Insane poster
  • *****
  • Posts: 758
  • I'm only trying to help i mean no offense.
    • View Profile
    • none - google translate
Re: How to run Apache and HTTPFileServer both on port 80?
« Reply #1 on: March 29, 2016, 07:35:24 AM »
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
I'm only trying to help i mean no offense.
thank you for your time and patience,
Bmartino1

Offline rejetto

  • Administrator
  • Insane programmer
  • *
  • Posts: 12844
    • View Profile
Re: How to run Apache and HTTPFileServer both on port 80?
« Reply #2 on: March 29, 2016, 07:15:54 PM »
@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

  • Insane poster
  • *****
  • Posts: 758
  • I'm only trying to help i mean no offense.
    • View Profile
    • none - google translate
Re: How to run Apache and HTTPFileServer both on port 80?
« Reply #3 on: March 31, 2016, 07:12:42 AM »
@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....
I'm only trying to help i mean no offense.
thank you for your time and patience,
Bmartino1

Offline MarkV

  • Insane poster
  • *****
  • Posts: 745
    • View Profile
Re: How to run Apache and HTTPFileServer both on port 80?
« Reply #4 on: April 01, 2016, 10:55:29 PM »
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.