1
votes

Using Plesk with Apache and Nginx together on Centos.

Errors were being logged perfectly on;

/var/www/vhosts/example.com/logs/error_log

/var/www/vhosts/example.com/logs/proxy_error_log

I truncated the files by deleting and recreating them; now nothing is logged. File owner and the file permissions are all the same; but error logging has just stopped.

I check the other domains, they all perfectly work as supposed.

2

2 Answers

0
votes

Actually web server logs are stored in /var/www/vhosts/system/example.tld/logs/.

Log files in /var/www/vhosts/example.tld/logs/ it's not a files but hardlinks to files in /var/www/vhosts/system/example.tld/logs/. Pay attention for same inode number 261064:

# ls -lia /var/www/vhosts/example.tld/logs/error_log
261064 -rw-r--r--. 2 root root 2432 Jun  8 18:26 /var/www/vhosts/example.tld/logs/error_log
# ls -lia /var/www/vhosts/system/example.tld/logs/error_log
261064 -rw-r--r--. 2 root root 2432 Jun  8 18:26 /var/www/vhosts/system/example.tld/logs/error_log

when I've remove this file I've remove hardlink:

# rm /var/www/vhosts/example.tld/logs/error_log
rm: remove regular file `/var/www/vhosts/example.tld/logs/error_log'? y
# ls -lia /var/www/vhosts/system/example.tld/logs/error_log
261064 -rw-r--r--. 1 root root 2432 Jun  8 18:26 /var/www/vhosts/system/example.tld/logs/error_log

When I've create it again it will has own inode number(276777):

# touch /var/www/vhosts/example.tld/logs/error_log
# ls -lia /var/www/vhosts/example.tld/logs/error_log
276777 -rw-r--r--. 1 root root 0 Jun  8 18:33 /var/www/vhosts/example.tld/logs/error_log

So to solve you issue you just need to remove file you have created and create hardlink to file in system/log:

# rm /var/www/vhosts/example.tld/logs/error_log
# ln /var/www/vhosts/system/example.tld/logs/error_log /var/www/vhosts/example.tld/logs/error_log
# ls -lia /var/www/vhosts/example.tld/logs/error_log
261064 -rw-r--r--. 2 root root 2432 Jun  8 18:33 /var/www/vhosts/example.tld/logs/error_log
0
votes

the server probably still tries to write to the files you deleted. restart nginx and apache.