Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a nice little Server with Ubuntu 12.04 LTS with Apache controlled by plesk. Now I've installed nginx for my Gitlab subdomain.

But now nginx wants to control all. How can I configure the nginx server to provide only one subdomain:

share|improve this question
up vote 1 down vote accepted

You can't run them both on the same port. By default both will want to conquer and that's not on. Two simple choices:

  • Add an IP, bind nginx on its port 80, point DNS at that IP.
  • Set nginx up on another port (eg 8080) and use Apache's ProxyPass directive to push one virtualhost back to nginx:

    <VirtualHost *:80>
        DocumentRoot /path/to/myapp/public
        ProxyPass / http://localhost:8080/
        ProxyPassReverse / http://localhost:8080/

    This is actually quite common - just in reverse. Most people put nginx on the raw port 80 and let it handle raw file IO, and proxy back to Apache if they need something like mod_php. You could do that but it's very likely more work.

There are —as always— a hundred thousand million different ways of doing these sorts of things. These are the two main ones.

share|improve this answer

Your Answer


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.