• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • 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.

Issue Problems with Nginx domain configuration file

Mel

New Pleskian
Hello.
I have a problem with the Nginx configuration on a domain. Yesterday I entered a rule that was not executed and took nginx out of use. I can't restart Nginx anymore because it gives me this error:

Unable to manage service by nginxmng: ('start', 'nginx'). Error: [2019-11-20 16:50:45.835] ERR [util_exec] proc_close() failed ['/usr/local/psa/admin/bin/nginx-config' '-t'] with exit code [1] [2019-11-20 16:50:48.796] ERR [panel] Apache config (15742650330.90253900) generation failed: Template_Exception: nginx: [emerg] unexpected "\" in /etc/nginx/plesk.conf.d/vhosts/domain.conf:40 nginx: configuration file /etc/nginx/nginx.conf test failed file: /usr/local/psa/admin/plib/Template/Writer/Webserver/Abstract.php line: 75 code: 0 nginx: [emerg] unexpected "\" in /etc/nginx/plesk.conf.d/vhosts/domain.conf:40 nginx: configuration file /etc/nginx/nginx.conf test failed

on line 40 of /etc/nginx/plesk.conf.d/vhosts/domain.conf there is an empty line, there isn't "\"

upload_2019-11-20_17-29-13.png

Usage Plesk Obisdian 18.0.21 and all components are updated.

How can I solve it?
 
Last edited:
Now
Impossibile avviare il servizio: Unable to manage service by nginxmng: ('start', 'nginx'). Error: [2019-11-20 17:38:15.729] ERR [util_exec] proc_close() failed ['/usr/local/psa/admin/bin/nginx_control' '--start'] with exit code [1] Can not start proxy server:
 
The lines following the empty line look like custom commands. Do you have any custom Nginx rules in the "Apache & nginx" settings? Remove them, then try again.
 
That's exactly what I try to do from the Plesk panel but the moment I save it, I get the error. I have uninstalled and installed Ngin from Plesk many times. However, the moment the Nginx is activated by the Service Manager, the error is triggered again. Now I'm forced to use the server only with Apache because I can't solve the problem.
 
It does, but the user probably knows the file already, because the error message reads
... nginx: [emerg] unexpected "\" in /etc/nginx/plesk.conf.d/vhosts/domain.conf:40 nginx: configuration file /etc/nginx/nginx.conf test failed ...
The problem is likely caused by his custom configuration rules (like the rewrite rule for /booking/), but that is something only the user can find out on his system where he has place these rules.
 
It does, but the user probably knows the file already, because the error message reads
... nginx: [emerg] unexpected "\" in /etc/nginx/plesk.conf.d/vhosts/domain.conf:40 nginx: configuration file /etc/nginx/nginx.conf test failed ...
The problem is likely caused by his custom configuration rules (like the rewrite rule for /booking/), but that is something only the user can find out on his system where he has place these rules.

Is there one way to completely uninstall NGINX (including custom configuration files) in order to reinstall again?
 
As Peter mentioned before remove all the "Additional nginx directives" from "Apache & nginx Settings" from all the Domains and use,

#plesk repair web

To regenerate the config files.
 
Sounds like @Mel is getting an error in the Plesk interface as soon as he tries to save the changes, even with the Additional nginx directives being empty when saving.

Mel, when you open the page in Plesk, is the Additional nginx directives field empty to begin with or do you see your erroneous directive, but you can't remove it? Does it help to run 'plesk repair web' at any point?

Hm... a thought occurred to me, that you might want to short cut all this troubleshooting and simply remove the hosting for the domain. Do have complete and valid backups! Web contents, databases, mailboxes... everything. Do not remove the entire domain, especially if you have mailboxes, just the hosting.

Afterwards, reactivate nginx server wide and only then recreate the hosting for this domain.

Not ideal, I know, and some meta data will be lost, but sometimes quick & dirty solutions can be the most efficient...
 
Mel, when you open the page in Plesk, is the Additional nginx directives field empty to begin with or do you see your erroneous directive, but you can't remove it? Does it help to run 'plesk repair web' at any point?
yes I see my erroneous directive but can't remove it because triggers the error again
Sounds like @Mel is getting an error in the Plesk interface as soon as he tries to save the changes, even with the Additional nginx directives being empty when saving.

Mel, when you open the page in Plesk, is the Additional nginx directives field empty to begin with or do you see your erroneous directive, but you can't remove it? Does it help to run 'plesk repair web' at any point?

Hm... a thought occurred to me, that you might want to short cut all this troubleshooting and simply remove the hosting for the domain. Do have complete and valid backups! Web contents, databases, mailboxes... everything. Do not remove the entire domain, especially if you have mailboxes, just the hosting.

Afterwards, reactivate nginx server wide and only then recreate the hosting for this domain.

Not ideal, I know, and some meta data will be lost, but sometimes quick & dirty solutions can be the most efficient...
 
Hm... a thought occurred to me, that you might want to short cut all this troubleshooting and simply remove the hosting for the domain. Do have complete and valid backups! Web contents, databases, mailboxes... everything. Do not remove the entire domain, especially if you have mailboxes, just the hosting.

Afterwards, reactivate nginx server wide and only then recreate the hosting for this domain.

Not ideal, I know, and some meta data will be lost, but sometimes quick & dirty solutions can be the most efficient...
This is a domain very important
 
Hi, Mel. Please try contacting support. More detailed information is needed to solve your problem.
 
  1. You need to enable debug mode: How to enable / disable Plesk debug mode
  2. Run: plesk sbin httpdmng --reconfigure-domain domain.com
  3. Find in the log file (/var/log/plesk/panel.log) nginx config that is created during the reconfiguration. That's the problem. I think some of the extensions return an incorrect configuration.
 
Last edited:
  1. You need to enable debug mode: How to enable / disable Plesk debug mode
  2. Run: plesk sbin httpdmng --reconfigure-domain domain.com
  3. Find in the log file (/var/log/plesk/panel.log) nginx config that is created during the reconfiguration. That's the problem. I think some of the extensions return an incorrect configuration.
This is error
on line 40 of /etc/nginx/plesk.conf.d/vhosts/domain.conf there is an empty line, there isn't "\"
but don't true
upload_2019-11-20_17-29-13-png.16143
 
Configurazione Nginx non valida: nginx: [emerg] zona "proxy_cache" "domain.com_proxy" è sconosciuta in /etc/nginx/nginx.conf:41 nginx: file di configurazione /etc/nginx/nginx.conf test fallitoImpossibile usare il file file di configurazione Nginx e ripristinare la versione precedente del file perché entrambi impostati una configurazione non valida.
 
unexpected "\" in /etc/nginx/plesk.conf.d/$
2019/12/02 17:59:01 [emerg] 59835#0: "proxy_cache" zone "domain.com_proxy" i$
2019/12/02 17:59:42 [emerg] 60757#0: "proxy_cache" zone "domain.com_proxy" i$
2019/12/02 17:59:42 [emerg] 60780#0: "proxy_cache" zone "domain.com_proxy" i$
 
Email:
Template_Exception: nginx: [emerg] unexpected "\" in /etc/nginx/plesk.conf.d/vhosts/domain.com
  1. You need to enable debug mode: How to enable / disable Plesk debug mode
  2. Run: plesk sbin httpdmng --reconfigure-domain domain.com
  3. Find in the log file (/var/log/plesk/panel.log) nginx config that is created during the reconfiguration. That's the problem. I think some of the extensions return an incorrect configuration.
.conf:40

nginx: configuration file /etc/nginx/nginx.conf test failed


file: /usr/local/psa/admin/plib/Template/Writer/Webserver/Abstract.php

line: 75

code: 0


Please resolve the errors in web server configuration templates and generate the file again.
 
Back
Top