Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 7 down vote accepted

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.

share|improve this answer
    
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 <VirtualHost> 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 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 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 <VirtualHost> that's configured to do the proxying. –  Shane Madden Oct 10 '11 at 20:57

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.

share|improve this answer
    
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 mydomain.com:8080/index.html or something like that. –  Bart Silverstrim Oct 10 '11 at 20:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.