Expandmenu Shrunk


apache

Apache

 

How to fix Apache – “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName?

sudo nano /etc/apache2/httpd.conf
Add the following line to the file.
ServerName? localhost
sudo /etc/init.d/apache2 restart

 


Running more than one site on Apache

 http://www.debian-administration.org/articles/412

Do the above. (make the sites-available file (copy an existing one), edit the first few lines, sudo a2ensite filename then apache2 reload)
Log into Afraid.org
Add the extra site, make sure the dynamic dns is linked (thus the script that runs on tomato (on the router) works for all web sites).
Add both www and the site.com
Put afraid.org’s name server’s in the place that you bought the domain name off.

 

———————————————————————————–

web log analyzers

awstats

Create a copy of awstats.conf for each domain:

cp /etc/awstats/awstats.conf /etc/awstats/awstats.yourdomain.ext.conf

modify the file:
nano /etc/awstats/awstats.yourdomain.ext.conf
make the following changes:

LogFile?=”/var/log/apache2/access.log”
SiteDomain?=”yourdomain”
HostAliases?=”localhost 127.0.0.1 yourdomain.ext”

generate the initial stats for AWStats based on existing var/log/apache2/access.log:

/usr/lib/cgi-bin/awstats.pl -config=yourdomain.ext -update
Apache2 Configuration

In order to access Awstats, we have to tell Apache2 where it is.
cd /etc/apache2/sites-available/
If you have no VirtualHosts? set up, place the following code in ‘/etc/apache2/sites-available/default’. Otherwise, add this code inside the VirtualHost? tag for each domain you want to monitor:

Alias /awstatsclasses “/usr/share/awstats/lib/”
Alias /awstats-icon/ “/usr/share/awstats/icon/”
Alias /awstatscss “/usr/share/doc/awstats/examples/css”
ScriptAlias? /awstats/ /usr/lib/cgi-bin/
Options ExecCGI –MultiViews? +SymLinksIfOwnerMatch?

Reload apache2:

/etc/init.d/apache2 reload

Statistics for yourdomain.ext should now be available at:

 http://yourdomain.ext/awstats/awstats.pl[[BR]] and:
 http://yourdomain.ext/awstats/awstats.pl?config=yourdomain.ext[[BR]] for if you have multiple config files. Note that these statistics are public unless you secure them.


webalizer

sudo apt-get install webalizer
View your stats at;
 http://localhost/webalizer/


conjob for the stats creation

Both will need (or will automatically make)conjobs.
If you are looking for them (to change how often they run), they are under sudo contab -l
Not the users usual crontab -l


Secure them

You have to password protect them, other wise spiders get into them and can use them to divert traffic to those other sites….

Webalizer was easy as its got a solid path from the web directory (/var/www), but awstats confused me as it was gci generated.
Turns out you have to first tell apache2 to block the root call to ‘awstats.pl’… here is how….

Password protect the awstats stats.
Add this to either your httpd.conf: (it may well be the only thing in there, that’s fine).

<filesmatch "awstats.pl">
AuthType Basic
AuthName "Stats"
AuthUserFile /path/to/awstats.htpasswd (or some other .htpasswd)
Require valid-user
</filesmatch>

Filesmatch make sure any attempt to access the file awstats.pl will now require a password.

Restart apache to make you changes take affect and make sure it works.