Hi,

You might be aware that if a DNS request point your nginx server.

and this later do not have a server rule for it , nginx will server anyway the first server found in your config file, WTF !

So I’ve found https://stackoverflow.com/a/23281442

server {
  listen       80 default_server;
  server_name  everythingelse;

  error_page 404 /404.html;

  # Everything is a 404
  location / {
    return 404; #return the code 404
  }

  # link the code to the file
  location = /404.html {
    #EDIT this line to make it match the folder where there is your errors page
    #Dont forget to create 404.html in this folder
    root  /var/www/nginx/errors/;
  }
}

But this is not working !

I made one of my domain pointing to this nginx server, and he still server another site aka server For httpS for http nothing appear…

Thanks.

You are viewing a single thread.
View all comments
1 point
*

Just guessing, but should it be pointing at 404.txt, not /404.txt

permalink
report
reply
1 point

line 5 you mean ?

error_page 404 /404.html; #this one ?
permalink
report
parent
reply

Web Development

!webdev@programming.dev

Create post

Welcome to the web development community! This is a place to post, discuss, get help about, etc. anything related to web development

What is web development?

Web development is the process of creating websites or web applications

Rules/Guidelines

  • Follow the programming.dev site rules
  • Keep content related to web development
  • If what you’re posting relates to one of the related communities, crosspost it into there to help them grow
  • If youre posting an article older than two years put the year it was made in brackets after the title

Related Communities

Wormhole

Some webdev blogs

Not sure what to post in here? Want some web development related things to read?

Heres a couple blogs that have web development related content

Credits

Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient

Community stats

  • 6

    Monthly active users

  • 317

    Posts

  • 1.1K

    Comments