• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

How do I create a new global domain for use with AWStats?

M

mindblender

Guest
I am wanting to create a new global domain, stats.<domain, that points to a common directory where I will have AWstats installed and allow them to view the stats for their domain. I've done some searching thru the forum and I must be blind as how to set something like this Is there a way to do this within Plesk itself or will I need to modify the httpd files manually?

Any suggestions you might have would be greatly appreciated.
 
I'm not sure this is possible out of the box, because as I can tell cgi-bin support isn't there for subdomains. here is what I have done for awstats which will be loaded com /stats

I finally figured out how to roll out awstats on each domain I deploy now. I used the skeleton structure that is part of plesk. What they don't tell you is that the entire skelton structure is parsed and any time it comes across the @domain_name@ tag it just replaces it with the domain name being installed.

Basically I just created a domain in plesk and installed awstats, once that was installed I just tared up the dirs and uploaded it to plesk, now all domains have awstats enabled by default. The only thing left to do is manually add a cron job that will parse the files for you, and update the stats. This I believe could be automated with the help of the event manager, but I haven't got there yet.
Here is a rundown of what I did.

1.) download awstats
2.) tar zxf awstats
3.) mkdir /home/httpd/vhosts/domain/httpdocs/stats
4.) cp awstats/wwwroot/* /home/httpd/vhosts/domain/httpdocs/stats/
5.) mv /home/httpd/vhosts/domain/httpdocs/stats/cgi-bin/* /home/httpd/vhosts/domain/cgi-bin/
6.) rm /home/httpd/vhosts/domain/httpdocs/stats/cgi-bin/ -rf
7.) cd /home/httpd/vhosts/domain/cgi-bin
8.) edit awstats.model.conf place your domain name in the correct places, tell it where to find the access_log etc. Update the location of icon css, and js to /stats/js/ or where ever you put them. Save it as awstats.conf
9.) chown user.psacln * -R where user is the domain user
10.) create an /stats/index.html that will redirect to cgi-bin/awstats.pl this was your users have an easy way to get to their stats.
11.) Test your install make sure that awstats works, then edit your index.html and awstats.conf file replace any instance of your domain name with @domain_name@ this will fix all the paths etc.
12.) cd /home/httpd/vhosts/domain/
13.) tar xcz skel.tgz cgi-bin httpdocs
14.) upload the new skel.tgz to plesk,
15.) create a domain
16.) add /home/httpd/vhosts/domain/cgi-bin/awstats.pl -config=/home/httpd/vhosts/domain/cgi-bin/awstats.conf -update >/dev/null 2>&1 to your cron have it run 55 * * * * for every hour and 55 to catch it before plesk does it’s nightly hiding of logs.


hope that helps you out all. I will post a generic skel file confirmed all the bugs are worked out.

exothermic

PS if anyone figures the eventmanager script to add a cron please post it. then this process will be fully automated.
 
login as root

create the following script /root/bin/awstats-logs and change the filename to the correct domainname.

Code:
##### DOMAINNAME #####
cd /home/httpd/vhosts/DOMAINNAME.com/httpdocs/awstats/main
./awstats.pl -update -config=awstats.conf
chown -R apache:apache *


Then go to the control panel and find the task with "/usr/local/psa/admin/sbin/statistics >/dev/null 2>&1"

and make it

/root/bin/awstats-logs >/dev/null 2>&1 && /usr/local/psa/admin/sbin/statistics >/dev/null 2>&1

Its generally better to leave the permissions as apache to allow the script to run and amend files from the browser .
 
While this does work it totally defeats the purpose. If I wanted to perform an action for everydomain that I rolled out, then I would just add this line to the cron

/home/httpd/vhosts/domain/cgi-bin/awstats.pl -config=/home/httpd/vhosts/domain/cgi-bin/awstats.conf -update >/dev/null 2>&1

for each domain. I'm looking for a solution that is done automatically for every domain that I roll out. I don't want to have to manually create some file each time.
 
Back
Top