View/Enable Website Logs on Linux Cloud Servers

Published: 2021-07-07


View Website Logs

BT Environment

Enter BT admin panel, click "Website" on the left-corresponding site--click "Settings"-configuration file, view the access_log line (access_log is the website access log, error_log is the website error log)

Image1.png


WDCP Environment

Enter wdcp and click "Site Management"-"Site List" on the left, find the site to configure, click the corresponding "Edit" button after the site, check "Enable Access Log", and the log file directory is /home/web_logs

Image2.png


Self-built web environment

Log in to the server remotely via ssh and run the following command

netstat  -tnpl

Check the PID of the web service listening on port 80 or 443

Image3.png

Run the following command

ll  /proc/2908/fd

Image4.png

/home/web_logs/xxx_access.log is the access log.


View website configuration file

Log in to the server remotely via ssh and run the following commands

netstat  -tnpl      # Check the PID number of the web service listening on port 80 or 443
ll /proc/pid_number/exe

Image5.png

You can find the current web service directory (/www/server/nginx). Enter the conf directory under the web service directory (command: cd /www/server/nginx/conf ), view the nginx.conf (command: vi nginx.conf ) file to find the path of the site configuration file.

Image6.png

The apache environment configuration file is httpd.conf (command: vi httpd.conf)

Image7.png

Enter the corresponding path directory (command: cd  /www/server/panel/vhost/nginx/ ) to see the configuration files of the corresponding websites. If there are many configuration files, you can run the following command

grep 'xxx.com' *

Find the corresponding configuration file.


Enable website logs

Nginx

Use vi to edit the site configuration file and add

Image.png

Save and exit, and restart the nginx service.

Apache

First, find the apache service path as described above, enter the conf directory, view the httpd.conf file, and check the logFormat format

Image.png

Then use vi to edit the site configuration file and add:

Image.png

Save and exit, and restart the aapche service.