Nginx newbie pitfall #1 (a.k.a. I cannot see my webapp on port 80)

I’ve been playing around with NGINX which claims to kick Apache’s rear-end when it comes to performance. So I installed Nginx on my Ubuntu 14.04 box and accessed the default “Welcome to nginx!” page from my browser. Simple it worked!

Later I wanted to configure my own webapp on port 80. So I did the following.

  1. Create my own coolapp_nginx.conf file typically in /etc/nginx/sites-available with server port 80.
  2. Create symbolic link to above file in /etc/nginx/sites-enabled. (this is the folder actually read by nginx)
  3. Restart nginx service.

Hmmm..but I’m still getting the default “Welcome to nginx!” page? bummer!.

The problem: I forgot to remove the symlink to default config file from /etc/nginx/sites-enabled. Once this link was removed (or the port defined in it was changed to something other than 80), my webapp was picked up.

So the steps if you want to configure your webapp on nginx for port 80 is

  1. Create your own coolapp_nginx.conf file.
  2. Create symbolic link to coolapp_nginx.conf file in /etc/nginx/sites-enabled.
  3. Remove symbolic link /etc/nginx/sites-enabled/default
  4. Restart nginx service.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s