I created one html file under one user file, and I want Nginx to serve this html file. But the website always show the default one. I am new to Nginx, I want someone help me with this. html path

Nginx Configuration

Default website


Any help would be grateful, I really want some help with that. Thank You


  • screenshots updated now, please check
    – billcyz
    Dec 27, 2014 at 11:56
  • 4
    Please do not use screen shots of configurations. Paste your configuration as text.
    – Paul
    Dec 27, 2014 at 12:38

1 Answer 1


Answer updated thanks to Tero Kilkanen observation

I believe the issue is caused by the server_name you have specified. Upon looking at the Nginx documentation (http://nginx.org/en/docs/http/server_names.html) the server_name needs to be in 1 of the following formats:

exact name
longest wildcard name starting with an asterisk, e.g. “*.example.org”
longest wildcard name ending with an asterisk, e.g. “mail.*”
first matching regular expression (in order of appearance in a configuration file)

The documentation does have an example that has a _ as a server_name however the listen directive declares it as the default server. So looking at your config if you change it to be the following it should work:

server {
    listen 11080  default_server;
    server_name  _;
    location / {
        root /home/tester/index;
        index web.html;

On a side note as Paul noted it is best not to use screenshots for configuration files. The reasons are that:

  1. It makes it harder for anyone to replicate the issue as they have to type what can be long config files.
  2. It makes it harder for someone to read the question on non PC devices (imagine trying to read the screen shots on a phone). It is hard enough on a PC.
  3. There is less chance of anyone in future being able to find a similar question
  • A better way is to use default_server attribute in listen directive. Dec 27, 2014 at 13:10
  • Thank you Tero, it did cross my mind that a regular expression was a bit overkill at the time to be honest.
    – Peter
    Dec 27, 2014 at 13:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .