Welcome! Log In Create A New Profile

Advanced

Nginx ERR_CONNECTION_RESET

Posted by cameratown 
Nginx ERR_CONNECTION_RESET
September 19, 2024 05:10PM
Hi,
I have a WordPress site on Ubuntu 24.04 with Nginx 1.24.0 as web server software. The site is behind a NetworkSolutions load balancer which handles the SSL cert.

I am running into a "ERR_CONNECTION_RESET " error when I change the Load Balancer to only accept HTTPS (443) and configure my default Nginx config file to listen on port 443. Everything is fine on 80.

My config file:

```
server {

listen 443;
listen [::]:443;
server_name site.mysite.com;


add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";

root /var/www/html/web;
index index.php index.html index.htm;

charset utf-8;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location = /favicon.ico {
access_log off;
log_not_found off;
}

location = /robots.txt {
access_log off;
log_not_found off;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
#fastcgi_index index.php;
include fastcgi_params;
}

location ~ /\.(?!well-known).* {
deny all;
}

error_page 404 /index.php;

access_log /var/log/nginx/site.mysite.com.access.log;
error_log /var/log/nginx/site.mysite.com.error.log error;

}
```

In wp-config, this logic is implemented to force HTTPS:
```
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS']='on';

```

The firewall on the server has all necessary ports open as well.

Another note as this all works great on port 80. The SSL cert works and the ```if``` statement in the wp-config file is commented out so ``` $_SERVER['HTTPS']='on';``` makes everything HTTPS, but I do not want to do this.

Any thoughts on why 443 is throwing this error?

Thanks in advance
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 260
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready