1

I know the following is impossible, but there should be a workaround.

As I'm now having problems with my very-clickable application,

(visits) (page views) (hits)    (data)

enter image description here

(~100 000 php page views every day) I decided to try HipHop-PHP, an opensource application from Facebook.

It should be able to transfer my application to c++ code and compile it. It should act as a webserver, like apache. The biggest problem is that I do not need/want a compiled application on the other websites. Why is it a problem? It runs on port 80, as my apache2 does and it is just not possible.

Is there a way to run 2 webservers on one virtual server?

genesis
  • 343
  • 4
  • 15

2 Answers2

7

Another option would be to have HPHP listen on a high port and have Apache reverse-proxy requests for the domain using HPHP to that high port.

Shane Madden
  • 114,520
  • 13
  • 181
  • 251
  • So I'd have to use apache2 as the gate between apache and HPHP? – genesis Oct 10 '11 at 20:50
  • Indeed - you'd set up a `` for the site that needs to be fed to HPHP, set `ProxyPass / http://127.0.0.1:8000/` (set to whichever non-80 port you use), and set the appropriate `ServerName`. – Shane Madden Oct 10 '11 at 20:53
  • You can have virtual directories defined in your apache configuration which would be simply internally reverse-proxied to a server of your choice. See [the docs](http://httpd.apache.org/docs/current/mod/mod_proxy.html) for more information. – the-wabbit Oct 10 '11 at 20:54
  • @ShaneMadden: Okay, so if I understand correctly, user would see no difference but user which access http://mydomain.com on port 80 uses `ProxyPass http://127.0.0.1/8080/` so all requests from port 80 are directed to 8080? – genesis Oct 10 '11 at 20:55
  • @genesis-φ Not all requests to port 80, just those matching the `ServerName` in the `` that's configured to do the proxying. – Shane Madden Oct 10 '11 at 20:57
6

You can create multiple virtual domains, but if you're thinking of having more than one web server on one IP running on port 80, no. You'd have to have multiple IP's on the virtual server.

If you can get multiple IP's, then yes, you'd bind your web servers to the IP address assigned on port 80 and you can do that on one virtual machine.

Bart Silverstrim
  • 31,172
  • 9
  • 67
  • 87
  • And is it possible to run first one on 8080 and the others on 80 ? Will user's browser know where to "ask" ? – genesis Oct 10 '11 at 20:47
  • @genesis-φ Port numbers != 80 will need to be included in the URL, unless you're employing some kind of URL rewriting, with .htaccess for example. Or see Shane's answer on reverse proxying. – squillman Oct 10 '11 at 20:49
  • 1
    You can do reverse proxying or putting them on other ports, but if you're primarily trying to fit multiple sites on the one server, personally I'd try to use either virtual domains or, if you have multiple IP's available, it's easier to manage if you use multiple IP's. Otherwise like Squillman said, yes, you can put them on other ports, but you must direct them as http://www.mydomain.com:8080/index.html or something like that. – Bart Silverstrim Oct 10 '11 at 20:55