1

I currently have a web server running apache with multiple sites on it using virtual hosts. I want to add a service to my server that is using nodejs but I want it to be accessible under the same domain as a sub-domain. This is, I believe, impossible with my current setup since nodejs and apache can't both listen on port 80 simultaneously, so I suppose I must run some proxy service on port 80 and then split my requests between the two servers based on the Host request header.

I have a few questions regarding this matter:

  • Are my above assumptions correct?
  • Is such a proxy setup costly in terms of performance?
  • What would be the best suited software to serve as the proxy? Is it best to stick with a server implementation (such as apache or nginx) for the proxy software or would a simple tcp server script perform better since it would be designed especially for this matter?
asked Sep 18, 2017 at 4:27

1 Answer 1

1

As you have described the problem, yes your assumptions are correct.

Both NGINX and Apache are built to do this in a very performant way. mod_proxy in Apache or proxy_pass in NGINX are likely to be much easier and perform far better than any custom proxy you might write. The only reason I can think of not to use them is if your logic for selecting the backend service is more complex than they are built for. Just having a subdomain as the selection criteria is trivial to either.

answered Sep 18, 2017 at 10:08

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.