• 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 error 404 newly created website

christian

Basic Pleskian
on plesk 12.5 centos 7 , when we create new website, we have a problem of error 404 for files (js, css and others)
we was verified files, rights and owner, all, are good.
the only way to resolve it is to restart nginx.
but, it's a real problem for us, because the server host lot of websites.
restarting nginx cause loss of requests fr other websites.
there is any way to force refresh or delete cache of nginx, without restarting it,
or
Additional nginx directives to force refresh for the website.?

i don't know for now how to configure correct nginx directive, help welcome.;
 
Hi christian,

you have the choice to use ( logged in as user "root" over SSH ):
Code:
service nginx reload
... which will reload all of you configuration files. There is as well the option to use:
Code:
/usr/sbin/nginx -s reload


Additional informations:


You should consider to use as well
Code:
nginx -t
BEFORE a nginx restart/reload, as this will point you directly to possible issues/errors/problems or misconfigurations. ;)

Consider as well to read => CommandLine | NGINX for additional commands/informations for nginx over your command line.
 
tested reload but it isn't effective.

searched more and found working solution.

i founded infos in logs saying "too many open files"
controling with
Code:
cat /proc/$(cat /var/run/nginx.pid)/limits|grep open.files
i got
Code:
Max open files            1024                 4096                 files
it seem the cause.

to resolve.
modify LimitNOFILE in /etc/systemd/system/nginx.service
Code:
vi /etc/systemd/system/nginx.service
after
Code:
# tuning of limits settings:
# 1. fill required limits as described in systemd.exec(5)
#       nginx.systemd content example for number of open files:
#       [Service]
#       LimitNOFILE=8192
# 2. restart service
add
Code:
[Service]
LimitNOFILE=65536
save file,
reload daemon
Code:
systemctl daemon-reload
restart nginx
Code:
systemctl restart nginx
and check result
Code:
cat /proc/$(cat /var/run/nginx.pid)/limits|grep open.files
Max open files            65536                65536                files
Code:
ps --ppid $(cat /var/run/nginx.pid) -o %p|sed '1d'|xargs -I{} cat /proc/{}/limits|grep open.files
Max open files            65536                65536                files
you will get line result for each nginx workers defined in /etc/nginx/nginx.conf -> worker_processes 1;
in my case i defined 4 workers, for 8 core server. so i got 4 lines returned.

so, stay a question, is that a good way to do?? or there is better/more secure way.?
 
Last edited:
Back
Top