# Getting rid of "Welcome to nginx"

**URL:** <https://www.ruby-forum.com/t/getting-rid-of-welcome-to-nginx/210760>\
**Category:** NGINX\
**Created:** [August 16, 2011, 8:37pm UTC](https://www.ruby-forum.com/t/getting-rid-of-welcome-to-nginx/210760 "2011-08-16T20:37:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [August 16, 2011, 8:37pm UTC](https://www.ruby-forum.com/t/getting-rid-of-welcome-to-nginx/210760/1 "2011-08-16T20:37:59Z")

</div>

Hi guys,

I’ve just setup nginx on my Ubuntu staging machine. Entering  
[http://192.168.1.1/index.php](http://192.168.1.1/index.php) works like a charm and loads the index.php  
file i’ve put in the /var/www/public\_html folder. [http://192.168.1.1](http://192.168.1.1)  
however instead shows the “Welcome to nginx!” page and not my index.php  
file.

What am I doing wrong? Here’s my nginx config:

server {

```
    listen 80 default;
    root /var/www/public_html;
    index index.php index.html index.htm;
    server_name _;

    location / {
            try_files $uri $uri/ /index.html;
    }

    location ~ \.php$ {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            include fastcgi_params;
    }

```

}

Posted at Nginx Forum:

> **[Getting rid of "Welcome to nginx"](https://forum.nginx.org/read.php?2,213878,213878#msg-213878)**
>
> Hi guys, I've just setup nginx on my Ubuntu staging machine. Entering http://192.168.1.1/index.php works like a charm and loads the index.php file i've put in the /var/www/public\_html folder. http://192.168.1.1 however instead shows the "Welcome...

---

<div class="post-metadata">

**Author:** ![joakim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/dec6dc/32.png) [@joakim](https://www.ruby-forum.com/u/joakim)\
**Post date:** [August 16, 2011, 9:43pm UTC](https://www.ruby-forum.com/t/getting-rid-of-welcome-to-nginx/210760/2 "2011-08-16T21:43:23Z")

</div>

Hi Joakim,

Your issue seems quite simple: You should use “try\_files $uri $uri/  
/index.php”, otherwise the .html version is shown.

Regards,  
Mathias Teugels

Posted at Nginx Forum:

> **[Re: Getting rid of "Welcome to nginx"](https://forum.nginx.org/read.php?2,213878,213883#msg-213883)**
>
> Hi guys, I've just setup nginx on my Ubuntu staging machine. Entering http://192.168.1.1/index.php works like a charm and loads the index.php file i've put in the /var/www/public\_html folder. http://192.168.1.1 however instead shows the "Welcome...

---

<div class="post-metadata">

**Author:** ![joakim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/dec6dc/32.png) [@joakim](https://www.ruby-forum.com/u/joakim)\
**Post date:** [August 16, 2011, 10:13pm UTC](https://www.ruby-forum.com/t/getting-rid-of-welcome-to-nginx/210760/3 "2011-08-16T22:13:38Z")

</div>

Hi Mathias,

Thanks for your answer. That won’t do it unfortunately. Also tried  
moving the “try\_files” param out of the “location /” bracket - no luck  
with that either.

What I did when setting up Nginx was following the instructions in the  
/etc/nginx/sites-available/default config file. So I created my new file  
containing the above config in “/etc/nginx/sites-available/local” and  
made a symlink to it in “etc/nginx/sites-enabled”.

I then restarted Nginx. I’ve messed around with the settings in my  
“local” file and seen PHP stopped working completely, so I know that  
Nginx actually are loading my config, but just ignore to call my  
index.php when the URL ends with / or /index.php…

Posted at Nginx Forum:

> **[Re: Getting rid of "Welcome to nginx"](https://forum.nginx.org/read.php?2,213878,213884#msg-213884)**
>
> Hi guys, I've just setup nginx on my Ubuntu staging machine. Entering http://192.168.1.1/index.php works like a charm and loads the index.php file i've put in the /var/www/public\_html folder. http://192.168.1.1 however instead shows the "Welcome...

---

<div class="post-metadata">

**Author:** ![joakim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/dec6dc/32.png) [@joakim](https://www.ruby-forum.com/u/joakim)\
**Post date:** [August 16, 2011, 10:50pm UTC](https://www.ruby-forum.com/t/getting-rid-of-welcome-to-nginx/210760/4 "2011-08-16T22:50:00Z")

</div>

On Wed, Aug 17, 2011 at 1:37 AM, Joakim [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi guys,
> 
> I’ve just setup nginx on my Ubuntu staging machine. Entering  
> [http://192.168.1.1/index.php](http://192.168.1.1/index.php) works like a charm and loads the index.php  
> file i’ve put in the /var/www/public\_html folder. [http://192.168.1.1](http://192.168.1.1)  
> however instead shows the “Welcome to nginx!” page and not my index.php  
> file.
> 
> What am I doing wrong? Here’s my nginx config:

have you tried clearing your browser’s cache?

---

<div class="post-metadata">

**Author:** ![joakim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/dec6dc/32.png) [@joakim](https://www.ruby-forum.com/u/joakim)\
**Post date:** [August 17, 2011, 2:47pm UTC](https://www.ruby-forum.com/t/getting-rid-of-welcome-to-nginx/210760/5 "2011-08-17T14:47:51Z")

</div>

Thanks Edho! That did it. I tried cleaning the cache when I first saw  
the error, but as I tried different settings I forgot to clean again.  
Never thought it were that simple 🙂

Posted at Nginx Forum:

> **[Re: Getting rid of "Welcome to nginx"](https://forum.nginx.org/read.php?2,213878,213914#msg-213914)**
>
> Hi guys, I've just setup nginx on my Ubuntu staging machine. Entering http://192.168.1.1/index.php works like a charm and loads the index.php file i've put in the /var/www/public\_html folder. http://192.168.1.1 however instead shows the "Welcome...
