# Welcome to nginx page displayed instead of actual content

**URL:** <https://forum.djangoproject.com/t/welcome-to-nginx-page-displayed-instead-of-actual-content/34762>\
**Category:** Using Django\
**Created:** [September 13, 2024, 3:27pm UTC](https://forum.djangoproject.com/t/welcome-to-nginx-page-displayed-instead-of-actual-content/34762 "2024-09-13T15:27:12Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![vixxhesh](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/vixxhesh/32/23867_2.png) [@vixxhesh](https://forum.djangoproject.com/u/vixxhesh)\
**Post date:** [September 13, 2024, 3:27pm UTC](https://forum.djangoproject.com/t/welcome-to-nginx-page-displayed-instead-of-actual-content/34762/1 "2024-09-13T15:27:12Z")

</div>

![Screenshot from 2024-09-13 20-54-29](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/3X/4/4/44c7e5afee0b592711bbc7277ff70d84302805f6.png)

I am seeing this page instead of my actual content.

> /etc/nginx/sites-enabled/spidernet

```auto
server {
    server_name 134.209.104.166 binodverma.com;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/vishesh/spidernet/staticfiles;
    }
    location /media/ {
        alias /home/vishesh/spidernet/media/; # Must be the same as MEDIA_ROOT
        access_log /var/log/nginx/media_access.log;
        error_log /var/log/nginx/media_error.log;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/run/gunicorn.sock;
	
	
	access_log /var/log/nginx/django_access.log;
        error_log /var/log/nginx/django_error.log;
    }

   

}

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [September 13, 2024, 3:44pm UTC](https://forum.djangoproject.com/t/welcome-to-nginx-page-displayed-instead-of-actual-content/34762/2 "2024-09-13T15:44:56Z")

</div>

> [@vixxhesh](#):
>
> `server_name 134.209.104.166 binodverma.com;`

This definition does not include `www.binodverma.com`.  
See the docs at [Server names](https://nginx.org/en/docs/http/server_names.html)

---

<div class="post-metadata">

**Author:** ![vixxhesh](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/vixxhesh/32/23867_2.png) [@vixxhesh](https://forum.djangoproject.com/u/vixxhesh)\
**Post date:** [September 13, 2024, 3:57pm UTC](https://forum.djangoproject.com/t/welcome-to-nginx-page-displayed-instead-of-actual-content/34762/3 "2024-09-13T15:57:06Z")

</div>

no effect on the output

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [September 13, 2024, 3:58pm UTC](https://forum.djangoproject.com/t/welcome-to-nginx-page-displayed-instead-of-actual-content/34762/4 "2024-09-13T15:58:10Z")

</div>

More specifics please. What did you try?

---

<div class="post-metadata">

**Author:** ![vixxhesh](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/vixxhesh/32/23867_2.png) [@vixxhesh](https://forum.djangoproject.com/u/vixxhesh)\
**Post date:** [September 13, 2024, 4:03pm UTC](https://forum.djangoproject.com/t/welcome-to-nginx-page-displayed-instead-of-actual-content/34762/5 "2024-09-13T16:03:26Z")

</div>

It was working fine a while earlier expect the static contents were not showing. However when I enabled HTTPS using certbot, after that only it was showing the Nginx page. I have deleted the default files in site-available. Moreover I deleted certbot certificate to see if its working but still the issue persist

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [September 13, 2024, 4:06pm UTC](https://forum.djangoproject.com/t/welcome-to-nginx-page-displayed-instead-of-actual-content/34762/6 "2024-09-13T16:06:34Z")

</div>

So what is the current configuration, and what is the url that you are entering into the browser?

---

<div class="post-metadata">

**Author:** ![vixxhesh](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/vixxhesh/32/23867_2.png) [@vixxhesh](https://forum.djangoproject.com/u/vixxhesh)\
**Post date:** [September 13, 2024, 4:14pm UTC](https://forum.djangoproject.com/t/welcome-to-nginx-page-displayed-instead-of-actual-content/34762/7 "2024-09-13T16:14:06Z")

</div>

**# configuration file /etc/nginx/nginx.conf:**

```auto
user www-data;
worker_processes auto;
pid /run/nginx.pid;
error_log /var/log/nginx/error.log;
include /etc/nginx/modules-enabled/*.conf;

events {
	worker_connections 768;
	# multi_accept on;
}

http {

	##
	# Basic Settings
	##

	sendfile on;
	tcp_nopush on;
	types_hash_max_size 2048;
	# server_tokens off;

	# server_names_hash_bucket_size 64;
	# server_name_in_redirect off;

	include /etc/nginx/mime.types;
	default_type application/octet-stream;

	##
	# SSL Settings
	##

	ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
	ssl_prefer_server_ciphers on;

	##
	# Logging Settings
	##

	access_log /var/log/nginx/access.log;

	##
	# Gzip Settings
	##

	gzip on;

	# gzip_vary on;
	# gzip_proxied any;
	# gzip_comp_level 6;
	# gzip_buffers 16 8k;
	# gzip_http_version 1.1;
	# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

	##
	# Virtual Host Configs
	##

	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;
}

```

**# configuration file /etc/nginx/sites-enabled/spidernet:**

```auto
server {
    server_name 134.209.104.166 binodverma.com;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/vishesh/spidernet/staticfiles;
    }
    location /media/ {
        alias /home/vishesh/spidernet/media/; # Must be the same as MEDIA_ROOT
        access_log /var/log/nginx/media_access.log;
        error_log /var/log/nginx/media_error.log;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/run/gunicorn.sock;
	
	
	access_log /var/log/nginx/django_access.log;
        error_log /var/log/nginx/django_error.log;
    }

   

}

```

**# configuration file /etc/nginx/proxy\_params:**

```auto
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

```

**settings.py**

```auto
import os
from pathlib import Path

BASE_DIR = Path( __file__ ).resolve().parent.parent

SECRET_KEY = ''

DEBUG = False

ALLOWED_HOSTS = ['134.209.104.166', 'binodverma.com', 'wwww.binodverma.com']

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'userauth',
    'blog',
    'tool_kit',
    'appointments',
    'contact',
    'adminp',
    'resource_store',
    'implinks',
]

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR / 'templates'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'spiderweb.urls'

WSGI_APPLICATION = 'spiderweb.wsgi.application'

import dj_database_url

DATABASES = {
    'default': dj_database_url.config(default='sqlite:///db.sqlite3')
}

BASE_DIR = Path( __file__ ).resolve().parent.parent
# Static files (CSS, JavaScript, Images)
STATIC_URL = '/static/'

# Static root for production
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles/')

# Additional directories where Django looks for static file

AUTH_USER_MODEL = 'userauth.CustomUser'

AUTHENTICATION_BACKENDS = [
    'django.contrib.auth.backends.ModelBackend', # Default

]

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

# Media files (Uploaded content)
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'

# Tells Django to use the X-Forwarded-Host header from the proxy, allowing it to know the original host requested by the client.
USE_X_FORWARDED_HOST = True
# Tells Django to use the X-Forwarded-Port header from the proxy, indicating the port number used by the client.
USE_X_FORWARDED_PORT = True
# Instructs Django to trust the X-Forwarded-Proto header, which is set by the proxy server, to determine whether the request is secure (HTTPS).
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

# Forces all HTTP requests to be redirected to HTTPS.
SECURE_SSL_REDIRECT = True

# Ensures that the CSRF cookie is only sent over HTTPS connections.
CSRF_COOKIE_SECURE = True
# Ensures that the session cookie is only sent over HTTPS connections.
SESSION_COOKIE_SECURE = True

# Enables HTTP Strict Transport Security (HSTS) for the specified duration (in seconds), forcing browsers to only connect via HTTPS.
SECURE_HSTS_SECONDS = 31536000
# Applies HSTS policy to all subdomains.
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
# Allows the domain to be included in browsers' HSTS preload list, ensuring maximum protection.
SECURE_HSTS_PRELOAD = True

# Enables the X-Content-Type-Options header, preventing browsers from MIME-sniffing a response away from the declared content-type.
SECURE_CONTENT_TYPE_NOSNIFF = True
# Controls the information sent in the Referer header, improving privacy and security by not sending the referrer from HTTPS to HTTP.
SECURE_REFERRER_POLICY = 'no-referrer-when-downgrade'

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [September 13, 2024, 4:20pm UTC](https://forum.djangoproject.com/t/welcome-to-nginx-page-displayed-instead-of-actual-content/34762/8 "2024-09-13T16:20:22Z")

</div>

What is the URL that you are currently entering in to your browser that is giving you the default nginx welcome page.

---

<div class="post-metadata">

**Author:** ![white-seolpyo](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/white-seolpyo/32/22386_2.png) [@white-seolpyo](https://forum.djangoproject.com/u/white-seolpyo)\
**Post date:** [September 14, 2024, 1:45am UTC](https://forum.djangoproject.com/t/welcome-to-nginx-page-displayed-instead-of-actual-content/34762/9 "2024-09-14T01:45:34Z")

</div>

are you sure run `/run/gunicorn.sock` and restart nginx?

---

<div class="post-metadata">

**Author:** ![vixxhesh](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/vixxhesh/32/23867_2.png) [@vixxhesh](https://forum.djangoproject.com/u/vixxhesh)\
**Post date:** [September 14, 2024, 7:28am UTC](https://forum.djangoproject.com/t/welcome-to-nginx-page-displayed-instead-of-actual-content/34762/10 "2024-09-14T07:28:27Z")

</div>

yes. @KenWhitesell now its just unable to connect

---

<div class="post-metadata">

**Author:** ![anefta](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/anefta/32/10649_2.png) [@anefta](https://forum.djangoproject.com/u/anefta)\
**Post date:** [September 14, 2024, 11:22pm UTC](https://forum.djangoproject.com/t/welcome-to-nginx-page-displayed-instead-of-actual-content/34762/11 "2024-09-14T23:22:25Z")

</div>

1 - Clear your browser’s cache  
2 - Restart nginx, gunicorn etc  
3 - Check for permissions  
4 - Post your nginx error log
