Welcome! Log In Create A New Profile


how to remove default nginx index.html response

Posted by teliot 
how to remove default nginx index.html response
August 11, 2021 04:30AM
This is my nginx config https://paste.nginx.org/3c i have removed the default server block and yet i still get the /var/www/html/index.nginx-debian.html being handed out by nginx when i visit https://shstats.teliot.dev/index.html when i change the index.html to search.php i get an expected not found response from the target apache server. the apache target server does not have nginx at all or any file that says nginx. it is a fresh install. this is all on my local network using the host file to point to the nginx server in a lab environment and confirmed with curl.

Thanks in advance!
Re: how to remove default nginx index.html response
August 11, 2021 02:27PM
Attached is the default page I am unable to remove from the configs.

This is what I get when I curl.

root@test:~# curl -i https://shstats.teliot.dev/index.html --resolve shstats.teliot.dev:443: --ins
HTTP/1.1 200 OK
Server: nginx/1.18.0 (Ubuntu)
Date: Wed, 11 Aug 2021 18:29:58 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Tue, 21 Apr 2020 14:09:01 GMT
Connection: keep-alive
ETag: "5e9efe7d-264"
Accept-Ranges: bytes

<!DOCTYPE html>
<title>Welcome to nginx!</title>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>

Edited 2 time(s). Last edit at 08/11/2021 02:31PM by teliot.
open | download - 2021-08-11 (3).png (24.6 KB)
open | download - 2021-08-11.png (24.7 KB)
open | download - 2021-08-11 (2).png (18.2 KB)
Re: how to remove default nginx index.html response
August 11, 2021 04:48PM
I found the issue was that nginx -V showed the compile time --prefix=/usr/share/nginx was passed to nginx by my distro. this folder has an html folder that is used when a root directive is missing from your server block.

I had already tried the following config but now that I think I know what the issue is I am sure I can figure it out.

server {
listen 443 ssl default_Server;
return 444;

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 216
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready