• 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.

Resolved Nginx error "nginx: [emerg] "server" directive is not allowed here in /etc/nginx/plesk.conf.d/vhosts/mydomain.conf:29"

Mikelug

New Pleskian
Server operating system version
Ubuntu 20.04
Plesk version and microupdate number
Plesk Obsidian v18.0.52_build1800230516.12
Hello, this morning plesk show the next error on screen:

New configuration files for the Apache web server were not created due to errors in the configuration templates: nginx: [emerg] "server" directive is not allowed here in /etc/nginx/plesk.conf.d/vhosts/mydomain.com.conf:29 nginx: configuration file /etc/nginx/nginx.conf test failed. Detailed error descriptions have been sent to your email address. Correct the errors and click here to regenerate the corrupted configuration files or click here to regenerate all configuration files. View details in the configuration troubleshooter

After some research I have not found anything, and the line referred to in the error is just a white line.
If anyone has been in the same situation, please tell me how to solve it, thank you.
 
Please check if you have "Additional Nginx Directives" set in <mydomain.com>. Maybe it was attempted to add a "server" block to it? If so, please remove or comment the block, then reconfigure the web server (e.g. Webserver Configuration Trouble Shooter > "Rebuild" > "Broken").
 
Please check if you have "Additional Nginx Directives" set in <mydomain.com>. Maybe it was attempted to add a "server" block to it? If so, please remove or comment the block, then reconfigure the web server (e.g. Webserver Configuration Trouble Shooter > "Rebuild" > "Broken").
Hello, this is the nginx configuration file that the error refers to, all configuration files for other vhosts have the same structure.


server {
listen "my IP":443 ssl;
ssl_certificate /opt/psa/var/certificates/"my certificate";
ssl_certificate_key /opt/psa/var/certificates/"my certificate";
server_name www.mydomain.com;
location / {
return 301 https://mydomain.com$request_uri;
}
}
server {
listen "my IP":443 ssl http2;
server_name mydomain.com;
server_name ipv4.mydomain.com;
ssl_certificate /opt/psa/var/certificates/"my certificate"; ssl_certificate_key /opt/psa/var/certificates/"my certificate";
client_max_body_size 134217728;
access_log "/var/www/vhosts/system/mydomain.com/logs/proxy_access_ssl_log";
error_log "/var/www/vhosts/system/mydomain.com/logs/proxy_error_log";
root "/var/www/vhosts/mydomain.com/httpdocs";
#extension letsencrypt begin
location ^~ /.well-known/acme-challenge/ {
root /var/www/vhosts/default/htdocs;
types { }
default_type text/plain;
satisfy any;
auth_basic off;
allow all;
location ~ ^/\.well-known/acme-challenge.*/\. {
deny all;
}
}
#extension letsencrypt end
#extension sslit begin
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains" always;
#OCSP Stapling
ssl_stapling on;
ssl_stapling_verify on;
#extension sslit end
#extension sectigo begin
location ^~ /.well-known/pki-validation/fileauth.txt {
try_files $uri $uri/ =404;
}
location ^~ /.well-known/pki-validation/ {
root /var/www/vhosts/default/htdocs;
types { }
default_type text/plain;
satisfy any;
auth_basic off;
allow all;
location ~ ^/\.well-known/pki-validation.*/\. {
deny all;
}
}
#extension sectigo end
#extension kolab begin
location ~* ^/autodiscover/autodiscover.xml {
proxy_pass https://127.0.0.1:7081;
proxy_set_header Host webmail.$host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~* ^/(\.well-known/autoconfig/|)mail/config-v1.1.xml {
proxy_pass https://127.0.0.1:7081;
proxy_set_header Host webmail.$host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#extension kolab end
error_page 400 "/error_docs/bad_request.html";
error_page 401 "/error_docs/unauthorized.html";
error_page 403 "/error_docs/forbidden.html";
error_page 404 "/error_docs/not_found.html";
error_page 500 "/error_docs/internal_server_error.html";
error_page 405 "/error_docs/method_not_allowed.html";
error_page 406 "/error_docs/not_acceptable.html";
error_page 407 "/error_docs/proxy_authentication_required.html";
error_page 412 "/error_docs/precondition_failed.html";
error_page 414 "/error_docs/request_uri_too_long.html";
error_page 415 "/error_docs/unsupported_media_type.html";
error_page 501 "/error_docs/not_implemented.html";
error_page 502 "/error_docs/bad_gateway.html";
error_page 503 "/error_docs/maintenance.html";
location ^~ /error_docs {
root "/var/www/vhosts/mydomain.com";
}
location / {
proxy_pass https://"my IP":7081;
proxy_hide_header upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
}
location ^~ /internal-nginx-static-location/ {
alias /var/www/vhosts/mydomain.com/httpdocs/;
internal;
}
location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
proxy_pass https://"my IP":7081;
proxy_hide_header upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
}
location ~ ^/~(.+?)(/.*?\.php)(/.*)?$ {
alias /var/www/vhosts/mydomain.com/web_users/$1/$2;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
try_files $uri $fastcgi_script_name =404;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass "unix:/var/www/vhosts/system/mydomain.com/php-fpm.sock";
include /etc/nginx/fastcgi.conf;
}
location ~ ^/~(.+?)(/.*)?$ {
proxy_pass https://"my IP":7081;
proxy_hide_header upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
}
location ~ \.php(/.*)?$ {
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
try_files $uri $fastcgi_script_name =404;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass "unix:/var/www/vhosts/system/mydomain.com/php-fpm.sock";
include /etc/nginx/fastcgi.conf;
}
disable_symlinks if_not_owner "from=/var/www/vhosts/mydomain.com";
add_header X-Powered-By PleskLin;
}
server {
listen "my IP":80;
server_name www.mydomain.com;
location / {
return 301 https://mydomain.com$request_uri;
}
}
server {
listen "my IP":80;
server_name mydomain.com;
server_name ipv4.mydomain.com;
client_max_body_size 134217728;
access_log "/var/www/vhosts/system/mydomain.com/logs/proxy_access_log";
error_log "/var/www/vhosts/system/mydomain.com/logs/proxy_error_log";
location / {
return 301 https://$host$request_uri;
}
}
 
I don't think this is solely related with Additional Directives as the OP has none declared.

I DO have additional directives declared (to allow listing of 2 sub-directories) and have the same error message this morning.

Plesk will not allow me to delete the Directives via the GUI. I suppose I could SSH and remove both the IPv4 and IPv6 declarations for both directives from the <domain.conf> file and rebuild it, but I'm reluctant to do that because of the fact the OP has the same fault without any Directives, plus I need the Directives declared, so if it was to resolve the problem, it would create another problem for me.

(or are you suggesting we remove the Directives, rebuild the templates and re-add the Directives Peter?)

Regards
 
Hi,
I have a seems to be the same problem since last night. It affects all webmails (Not Found The requested URL was not found on this server.)
Error: New configuration files for the Apache web server were not created due to the errors in configuration templates: nginx: [emerg] "server" directive is not allowed here in /etc/nginx/plesk.conf.d/vhosts/mydomain.co.uk.conf:31 nginx: configuration file /etc/nginx/nginx.conf test failed.
When logged by SSH, I can run the command:
root@host:/opt/psa# sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Will you help to find out how to make webmail work?
 
Hello,
I have the same problem on my server since today. I have succeeded to recreate the configuration files for all the domain but one. This domain has no additional Nginx directive set up in Plesk.

I've followed the instructions from this page : https://support.plesk.com/hc/en-us/articles/12377968168343

Check configuration only display "Success"

I have three errors :
Chemin d'accès du fichierTemplate orig.Domaine associé
error
/etc/nginx/plesk.conf.d/webmails/rathle.fr_webmail.conf
nginxWebmail.phprathle.frRechercher dans les fichiers logs
Recréer ce fichier de configuration
error
/var/www/vhosts/system/rathle.fr/conf/modsecurity_nginx.conf
nginxDomainModSecurity.phprathle.frRechercher dans les fichiers logs
Recréer ce fichier de configuration
error
/var/www/vhosts/system/rathle.fr/conf/nginx.conf
nginxDomainVhost.phprathle.frRechercher dans les fichiers logs
Recréer ce fichier de configuration

When I try to recreate each configuration file, I always get the same error message :

Erreur: Web server parameters cannot be reconfigured : Unable to execute httpdmng: [2023-06-14 11:35:47.029] 499421:648989ec59209 ERR [util_exec] proc_close() failed ['/opt/psa/admin/bin/nginx-config' '-t'] with exit code [1]
[2023-06-14 11:35:47.404] 499421:648989ec59209 ERR [panel] Apache config (16867353460.79021100) generation failed: Template_Exception: nginx: [emerg] "server" directive is not allowed here in /etc/nginx/plesk.conf.d/vhosts/rathle.fr.conf:29
nginx: configuration file /etc/nginx/nginx.conf test failed

file: /opt/psa/admin/plib/Template/Writer/Webserver/Abstract.php
line: 75
code: 0
nginx: [emerg] "server" directive is not allowed here in /etc/nginx/plesk.conf.d/vhosts/rathle.fr.conf:29
nginx: configuration file /etc/nginx/nginx.conf test failed

I've looked line 29 of /etc/nginx/plesk.conf.d/vhosts/rathle.fr.conf, this line is empty.

I only see two server directives in lines 22, and 23 :

server_name www.rathle.fr;
server_name ipv4.rathle.fr;

I let my domain name in the post, but I see some people don't. Is it for security reasons ?
 
While awaiting moderator approval,
I fixed the issue. Not sure which step fixed the problem, I am providing a list of what I did:
- Extensions | Repair Kit: fix all errors and repairs Plesk installation
- SSH apt update & apt upgrade
- reboot
- on each host, set RoundCube as webmail (it was set to Plesk email)
Errors are still there, but webmail is working.
 
Meanwhile we've seen similar situations on some installations and registered this as a product issue. ID PPPM-14026. I do not yet have an ETA when it will be fixed or what workaround can be provided. It is currently under research.
 
I experience exactly the same behavior. I reinstalled my Linux server and Plesk and then restored the backup. The problem was then temporarily solved but then occurred again after two days. Please find a solution!
 
If you are using Kolab / Plesk Premium Email, please try setting the preferred domain of the website(s) to "none".
 
Problem solved with latest update

Plesk Obsidian 18.0.53 Update 2​

20 June 2023

Fixed Product Issues​

  • It is again possible to manage user roles if an APS application is installed. (PPPM-14031)

Linux​

  • Nginx configuration is again correct if the “Plesk Premium Email, powered by Kolab” extension is installed. (PPPM-14026)
  • It is again possible to secure temporary domains with SSL/TLS certificates from Let’s Encrypt. (PPP-61697)
 
My server is running Ubuntu 18.04.6 LTS so I guess the last update broke Nginx config with PPE installed and as no further updates are possible on this os, now what?

Regards
 
Good morning, after the last update should I click on this message or not ?, I don't want to generate more problems on my server by generating new configuration files.

"New configuration files for the Apache web server were not created due to errors in the configuration templates: nginx: [emerg] "server" directive is not allowed here in /etc/nginx/plesk.conf.d/vhosts/mydomain.com.conf:29 nginx: configuration file /etc/nginx/nginx.conf test failed. Detailed error descriptions have been sent to your email address. Correct the errors and click here to regenerate the corrupted configuration files or click here to regenerate all configuration files. View details in the configuration troubleshooter"
 
Ubuntu 18 was end of life by the end of April 2023. Please upgrade to a newer Ubuntu.
Good morning, after the last update should I click on this message or not ?, I don't want to generate more problems on my server by generating new configuration files.

"New configuration files for the Apache web server were not created due to errors in the configuration templates: nginx: [emerg] "server" directive is not allowed here in /etc/nginx/plesk.conf.d/vhosts/mydomain.com.conf:29 nginx: configuration file /etc/nginx/nginx.conf test failed. Detailed error descriptions have been sent to your email address. Correct the errors and click here to regenerate the corrupted configuration files or click here to regenerate all configuration files. View details in the configuration troubleshooter"
any suggestions on this ?

Thanks.
 
Back
Top