Documentation for PHP Log Viewer Setup with Nginx
Overview
This documentation describes how to set up a PHP script to view logs via a webpage and configure Nginx to serve the log viewing functionality securely. The setup includes Nginx configuration and a PHP script for displaying logs.Nginx Configuration
Nginx Configuration File
Add the following configuration to your Nginx server block to serve a PHP script for viewing logs. This configuration assumes that you have PHP-FPM running and an.htpasswd file for basic authentication.
Basic Authentication
Create or modify the.htpasswd file to secure access to the log viewer. Use the htpasswd tool to create an encrypted password entry.
/etc/nginx/.htpasswd.
PHP Script for Viewing Logs
PHP Script (logs.php)
Create a PHP script at /var/www/project-path/public/logs.php to display the log file content. Ensure that the PHP script has appropriate permissions to read the log file.
