Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 just installed nginx on my Linux Mint system that already had apache2 working. However nginx took over all request to localhost and all my virtual domains and displayed the default page for nginx in response to every url. I assumed it just took over port 80 which apache2 was using. Anyway I tried to find a way to make nginx use port :8080 instead of :80 but all the information I found had to do with using nginx as some sort of front end for apache2, therefore nginx used :80 and the apache2 used :8080 instead.

In my case I just want them running independently of each other so that I can test stuff on apache2 and nginx exclusively of each other.

How can I make nginx use port :8080 instead of :80?

share|improve this question
up vote 4 down vote accepted

In your /etc/nginx/sites-available/default file, make sure it "listens" on your desired port;

server {
  listen 8080;



afterward, restart nginx

sudo service nginx restart
share|improve this answer
OP may also need to rejigger firewall rules to allow 8080 traffic. – cjc Mar 12 '12 at 16:46

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.