Articles in this section

Unable to repair web configuration: mktemp: failed to create file via template '/etc/nginx/plesk.conf.d/server.conf.XXXXXX': No such file or directory

Plesk for Linux kb: technical

Applicable to:

  • Plesk for Linux

Symptoms

  • It is not possible to restore website configuration with the error:

    ERR [panel] Apache config
    (16100623580.33783700) generation failed: Template_Exception:
    mkdir: cannot create directory '/etc/nginx/plesk.conf.d': No
    such file or directory
    mktemp: failed to create file via template
    '/etc/nginx/plesk.conf.d/server.conf.XXXXXX': No such file or
    directory
    Can not create temporary file

    file:
    /opt/psa/admin/plib/Template/Writer/Webserver/Abstract.php
    line: 75
    code: 0
    mkdir: cannot create directory '/etc/nginx/plesk.conf.d': No
    such file or directory
    mktemp: failed to create file via template
    '/etc/nginx/plesk.conf.d/server.conf.XXXXXX': No such file or
    directory
    Can not create temporary file

  • Test nginx configuration fails:

    # nginx -t
    nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory)
    2021/01/08 04:02:22 [emerg] 32934#0: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
    nginx: configuration file /etc/nginx/nginx.conf test failed

Cause

Plesk ships its own, pre-configured nginx.

The installed nginx package corrupted or replaced with incorrect one.

Resolution

via Plesk UI
  1. Log into Plesk
  2. Go to Tools & Settings > Updates > Add/Remove Components
  3. Uninstall nginx
  4. Install it back in the same way
  5. Repair web configuration
via CLI
  1. Connect to the server via SSH

  2. Remove nginx

    # /usr/local/psa/admin/bin/autoinstaller --select-product-id plesk --select-release-current --remove-component nginx

  3. Install nginx

    # plesk installer --select-release-current --install-component nginx

  4. Repair the configuration:

    # plesk repair web -y

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.