- Plesk for Linux
- The following error is displayed in Plesk interface when trying to rebuild web server configuration files:
PLESK_ERROR: New configuration files for the Apache web server were not created due to the errors in configuration templates: mkdir: cannot create directory `/var/www/vhosts/system/example.com/conf': No such file or directory mktemp: cannot create temp file /var/www/vhosts/system/example.com/conf/httpd.conf.XXXXXX: No such file or directory Can not create temporary file
When trying to create configuration files from console, the following error will be shown:
# /usr/local/psa/admin/bin/httpdmng --reconfigure-all
mkdir: cannot create directory
/var/www/vhosts/system/example.com/conf': No such file or directory mktemp: failed to create file via template/var/www/vhosts/system/example.com/conf/httpd.conf.XXXXXX': No such file or directory
Can not create temporary file
System does not exist in operating system, but exists in Plesk:
# grep johndoe /etc/passwd
Virtual host directory has been removed, but a domain/subdomain still have physical hosting in Plesk settings. As a result, the tool
fails to create configuration files.
- Connect to the server via SSH.
- Download, unpack, make executable, and run the following script:
# wget https://support.plesk.com/hc/article_attachments/115004516465/fix_vhosts.sh.zip
# unzip fix_vhosts.sh.zip
# chmod +x fix_vhosts.sh
# bash fix_vhosts.sh
The script does the following things:
- finds all domains with enabled physical hosting that have missing virtual host directories
- recreates the basic virtual host structure for these domains.
- If the sub-directories "conf" or "statistics/logs" are missing, directories will also be recreated with the correct permissions/ownerships.
- rebuilds web server configuration will then be rebuilt from scratch
Example output of the script:
# bash /fix_vhosts.sh
sub1.domain.test: no physical hosting definition in database.
customer1.tld: creating basic virtual host structure: ok
customer1.tld: creating 'conf' directory: ok
customer1.tld: creating 'logs' directory: ok
Rebuilding Apache configuration:ok