• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved NGINX RESTARTING EVERY 1/2 HOURS

H.K

New Pleskian
Hi,

I have a strange issue with Nginx, which is causing it to restart every 1 or 2 hours and send out a watchdog email.

The config seems fine

service nginx configtest
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful


Messages log contains.

mysqld: 2018-07-02 16:28:58 140201424836352 [Warning] Access denied for user 'wordpress_4'@'localhost' (using password: YES)

nginx error.log

2018/07/01 19:41:05 [error] 8548#0: *291 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 83.43.171.175, server: , request: "HEAD / HTTP/1.0", upstream: "http://217.182.xxx.85:7080/"
2018/07/01 22:56:08 [error] 5472#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 162.227.64.246, server: , request: "GET / HTTP/1.0", upstream: "http://217.182.242.102:7080/"
2018/07/01 22:58:16 [alert] 5472#0: *54 open socket #68 left in connection 13
2018/07/01 22:58:16 [alert] 5472#0: *53 open socket #64 left in connection 31


Nginx directives generally all domains

# gzip compression
gzip on;
gzip_min_length 100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_comp_level 7;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;

# Expire rules for static content

# cache.appcache, your document html and data
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
expires -1;
# access_log logs/static.log; # I don't usually include a static log
}

# Feed
location ~* \.(?:rss|atom)$ {
expires 1h;
add_header Cache-Control "public";
}

# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}

# CSS and Javascript
location ~* \.(?:css|js)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";
}

open_file_cache max=1000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 5;
open_file_cache_errors off;

if ($uri !~ ^/(plesk-stat|webstat|webstat-ssl|ftpstat|anon_ftpstat|awstats-icon|internal-nginx-static-location)) {
set $test "${test}C";
}
if ($test = PC) {
rewrite ^.*$ /index.php break;
}

location ~ /.well-known {
allow all;
}

if (!-e $request_filename) {
set $test P;
}
if ($uri !~ ^/(plesk-stat|webstat|webstat-ssl|ftpstat|anon_ftpstat|awstats-icon|internal-nginx-static-location)) {
set $test "${test}C";
}
if ($test = PC) {
rewrite ^/(.*)$ /index.php?$1;
}

DNS Is forwarded to Cloudflare at the register and not using Plesk Cloudflare module.

Is there any other logs, or how to look at whats causing this ?
 
How do you know that Nginx is restarting?
Could it simply be a restart because someone has changed the configuration of a website, so that the new configuration is loaded by Nginx?
 
How do you know that Nginx is restarting?

I am getting regular watchdog, Nginx has stopped/Restarted emails.

Could it simply be a restart because someone has changed the configuration of a website, so that the new configuration is loaded by Nginx?


I am the only user, there are very few domains and server load, with a lot of free resources.

I have this issue

Checking for extra configurations in database not owned by any object
There is an extra configuration with id 85 belongs to the missed domain with id 23
There is an extra configuration with id 86 belongs to the missed domain with id 23
There is an extra configuration with id 87 belongs to the missed domain with id 23
There is an extra configuration with id 88 belongs to the missed domain with id 23

There are some unnecessary configurations in the database. Please
check Webserver Configuration Troubleshooter detects extra configuration for solution ..................... [WARNING]

Found errors: 0; Found Warnings: 1

But cant resolve with web config module, problem remains.
 
Last edited:
There are some unnecessary configurations in the database.
you can fix the DB warning usualy when running on cli
# plesk repair db

but this should not have an impact on nginx. There must be something else, what are your watchdog settings for the nginx service?
 
Hi i have tried all these commands.

Plesk repair db/web/fs

They haven't helped, watchdog settings are default.

I'm hoping this is an issue with directives or DNS settings with one of the domains and testing.

But would be nice to see a log or something in error reports.
 
Last edited:
Isolating a domain seems to have resolved this, It has to be due to DNS or directives that was causing this.
 
Back
Top