Thursday, May 19, 2022

Database/SourceCode and Nginx/Server logs will Display on Subdomain

 

In This Post We will Configure A Backup Server For Logs and SorceCode/Database,
Which We can download over the sub-domain

 


Pre-Requirement:

Nginx Webserver
Domain & Sub-Domain


===========================================
Create Required Folder
===========================================



mkdir -p /var/www/html/wordpress
mkdir -p /var/www/html/logs



===========================================
Make Domain.conf and Add below content
===========================================


server {
       listen 80;

       server_name example.com;

       root /var/www/html/wordpress;
       index index.html;

     access_log /var/www/html/logs/access.log;
     error_log /var/www/html/logs/error.log;

       location / {
               try_files $uri $uri/ =404;
       }
}




===========================================
Make Sub-Domain.conf and Add below content
===========================================


server {

       server_name logs.example.com;


location /{
   root /var/www/html/logs/;
   index  index.html;
   autoindex on;
}

}



===========================================
Add Argument In Crontab

(*.log extiontion will not view, so that is why we are copying)
===========================================


* * * * * cp /var/www/html/logs/error.log  /var/www/html/logs/error.html
* * * * * cp /var/www/html/logs/access.log /var/www/html/logs/access.html




===========================================
Check In Browser
===========================================


http://logs.example.com



===========================================
Implement Domain Username And Password Authentication
===========================================



pending......

No comments:

Post a Comment

testing