400 The Plain Http Request Was Sent To Https Port

The 400 status code is a standard HTTP response code that indicates an error or problem with the request. In this case, the plain http request was sent to the https port, which suggests that Nginx is configured to serve HTTPS requests.

Configuring Nginx for HTTPS

Nginx can be configured to serve HTTPS requests by adding a configuration file or setting an environment variable. Here's an example of how to do this using a configuration file:

	# /etc/nginx/sites-available/https
server {
    listen 443 ssl;
    server_name example.com;

    location / {
        proxy_pass http://localhost:8080;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

Save this file as /etc/nginx/sites-available/https and reload Nginx to apply the changes:

Enabling HTTPS

To enable HTTPS, you'll need to configure Nginx to listen on port 443. You can do this by adding a configuration file or setting an environment variable.

Here's an example of how to do this using an environmental variable:

	Nginx Environmental Variable
	NGINX_ENV=production

Testing HTTPS

To test whether Nginx is serving HTTPS requests, you can add a simple test page to the root directory of your website. You can do this by adding a file named index.html to the root directory.

A simple test page might look like this:



Test Page


Welcome to our website!

https://iceclog.com/members/encoredataproducts/profile/