Installing a new webserver: Difference between revisions

From Edgar BV Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 39: Line 39:
DefaultRoot                    ~/../../
DefaultRoot                    ~/../../
# For AWStats
# For AWStats
<pre>
LogFormat awstats "%t  %h      %u      %m      %f      %s      %b"
LogFormat awstats "%t  %h      %u      %m      %f      %s      %b"
ExtendedLog /var/log/xferlog read,write awstats
ExtendedLog /var/log/xferlog read,write awstats
TransferLog none
TransferLog none
RequireValidShell off
RequireValidShell off
</pre>


 
<pre>
mkdir /home/adm_usr/webserveradmin/ -p
mkdir /home/adm_usr/webserveradmin/ -p
mkdir /opt/triphost/ -p
mkdir /opt/triphost/ -p
mkdir /opt/weblog/etc -p
mkdir /opt/weblog/etc -p
mkdir /opt/weblog/src -p
mkdir /opt/weblog/src -p
 
</pre>
copy the stuff from another webserver into these dirs and find and replace the servername in these directories.
copy the stuff from another webserver into these dirs and find and replace the servername in these directories.


<pre>
mkdir /home/sites/servername.tripany.com/site/sitestats/ -p
mkdir /home/sites/servername.tripany.com/site/sitestats/ -p
mkdir /home/sites/USGP.tripany.com/logs/
mkdir /home/sites/USGP.tripany.com/logs/
Line 61: Line 64:
/etc/apache2/sites-available/default
/etc/apache2/sites-available/default
/etc/apache2/listvirts (NB has to start at group 100!)
/etc/apache2/listvirts (NB has to start at group 100!)
</pre>
/etc/apache2/apache2.conf change LogFormat and add %v to the beginning of the the combined format
/etc/apache2/apache2.conf change LogFormat and add %v to the beginning of the the combined format
<pre>
LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
</pre>
change /etc/apache2/sites-available/default DocumentRoot to
/home/sites/servername/site


change /etc/apache2/sites-available/default DocumentRoot to /home/sites/servername/site


create /etc/apache2/sites-available/82.95.91.75 with DocumentRoot /home/sites by hand!
create /etc/apache2/sites-available/82.95.91.75 with DocumentRoot /home/sites by hand!
link it in in sites-enabled
link it in in sites-enabled


Line 75: Line 84:


vi /etc/apache2/conf.d/awstats
vi /etc/apache2/conf.d/awstats
<pre>
Alias /awstatsicon/ /usr/share/awstats/icon/
Alias /awstatsicon/ /usr/share/awstats/icon/
 
</pre>
<pre>
touch /var/log/statistics
touch /var/log/statistics
copy /etc/awstats/model.conf
copy /etc/awstats/model.conf
copy /etc/awstats/awstats.servername* (ftp / mail / web)
copy /etc/awstats/awstats.servername* (ftp / mail / web)
<pre>
run the statisticsrun in /etc/logrotate.d/apache2 by hand to see how it all goes!
run the statisticsrun in /etc/logrotate.d/apache2 by hand to see how it all goes!
<pre>
cp /opt/weblog/src/weblog_files/graphs/ /home/sites/USGP.tripany.com/site/webloggraphs/ -R
cp /opt/weblog/src/weblog_files/graphs/ /home/sites/USGP.tripany.com/site/webloggraphs/ -R
 
</pre>


shorewall (see knowledgebase page)
shorewall (see knowledgebase page)


postfix edits (knowledgebase)
postfix edits (knowledgebase)
postmap virtual
postmap virtual
postmap transport
postmap transport


vi /etc/procmailrc
vi /etc/procmailrc
------------
<pre>
#Procmailrc modified by RazoR
#Procmailrc modified by RazoR
#
#
Line 99: Line 115:
VERBOSE=off
VERBOSE=off
LOG=$date
LOG=$date
-------------
</pre>
touch /var/log/mail/procmail
touch /var/log/mail/procmail


logrotate procmail in the /etc/logrotate.d/rsyslog file
logrotate procmail in the /etc/logrotate.d/rsyslog file
 
<pre>
ln -s /home/spool/mail/ /var/mail
ln -s /home/spool/mail/ /var/mail
 
</pre>
edit /etc/syslogd.conf to log stuff to /var/log/mail
edit /etc/syslogd.conf to log stuff to /var/log/mail


-------
<pre>
mail.info                      -/var/log/mail/mail.info
mail.info                      -/var/log/mail/mail.info
mail.warn                      -/var/log/mail/mail.warn
mail.warn                      -/var/log/mail/mail.warn
mail.err                        /var/log/mail/mail.err
mail.err                        /var/log/mail/mail.err
-------
</pre>


FOR OLD SYSLOG BEHAVIOUR
FOR OLD SYSLOG BEHAVIOUR
------
<pre>
!popa3d
!popa3d
*.*                            /var/log/mail/popa3d.log
*.*                            /var/log/mail/popa3d.log
-------
</pre>


FOR RSYSLOG
FOR RSYSLOG
-------
<pre>
in /etc/rsyslog.d/popa3d.conf
in /etc/rsyslog.d/popa3d.conf


if $programname == 'popa3d' and $syslogseverity <= '6' then /var/log/mail/popa3d.log
if $programname == 'popa3d' and $syslogseverity <= '6' then /var/log/mail/popa3d.log
if $programname == 'popa3d' and $syslogseverity <= '6' then ~
if $programname == 'popa3d' and $syslogseverity <= '6' then ~
---------
</pre>


spamassassin (knowledgebase page)
spamassassin (knowledgebase page)
Line 137: Line 153:


backup scripts
backup scripts
</pre>

Revision as of 08:00, 7 May 2013

apt-get install mysql-server openssh-server proftpd apache2 libapache2-mod-perl2 libapache2-mod-php5 php5 php5-cli php5-ffmpeg php5-gd php5-imagick php5-mcrypt php5-mhash php5-mysql php5-xmlrpc php5-xsl php5-curl snmpd iotop mtop apachetop iptstate atsar postfix popa3d shorewall vim awstats bmon nscd sshfs mc zip unzip bzip2 arj spamassassin pyzor razor ncftp rsync phpmyadmin quota ntpdate ntp vacation pdnsd

pdnsd - use resolvconf configuration

Set up networking in /etc/network/interfaces
<pre>
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
#auto eth0
iface eth0 inet static
        address 192.168.0.112
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
#       gateway 192.168.0.1
        dns-nameservers 213.75.63.36 213.75.63.70 192.168.0.1
#       dns-nameservers 192.168.0.1 192.168.0.2
#       dns-search tripnet.int internal.tripnet.int ops.tripnet.int

auto eth1
iface eth1 inet static
        address 188.204.140.195
        netmask 255.255.255.224
        network 188.204.140.192
        broadcast 188.204.140.223
        gateway 188.204.140.193
        dns-nameservers 213.75.63.36 213.75.63.70 192.168.0.1

/etc/default/snmpd get rid of 127.0.0.1 /etc/snmp/snmpd.conf change community names

/etc/proftpd/proftpd.conf add DefaultRoot ~/../../

  1. For AWStats
LogFormat awstats "%t   %h      %u      %m      %f      %s      %b"
ExtendedLog /var/log/xferlog read,write awstats
TransferLog none
RequireValidShell off
mkdir /home/adm_usr/webserveradmin/ -p
mkdir /opt/triphost/ -p
mkdir /opt/weblog/etc -p
mkdir /opt/weblog/src -p

copy the stuff from another webserver into these dirs and find and replace the servername in these directories.

mkdir /home/sites/servername.tripany.com/site/sitestats/ -p
mkdir /home/sites/USGP.tripany.com/logs/
mkdir /home/sites/USGP.tripany.com/sites/ftpstats
chown razor /home/sites/servername.tripany.com/site -R
/etc/logrotate.d/apache2
mkdir /var/log/apache2/virts
mkdir /var/log/apache2/awstats
/etc/apache2/sites-available/default
/etc/apache2/listvirts (NB has to start at group 100!)

/etc/apache2/apache2.conf change LogFormat and add %v to the beginning of the the combined format

LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

change /etc/apache2/sites-available/default DocumentRoot to

/home/sites/servername/site


create /etc/apache2/sites-available/82.95.91.75 with DocumentRoot /home/sites by hand!

link it in in sites-enabled

check both sites to see if they go to different indexes.

a2enmod rewrite (or a2enmod for options list)

vi /etc/apache2/conf.d/awstats

Alias /awstatsicon/ /usr/share/awstats/icon/
touch /var/log/statistics
copy /etc/awstats/model.conf
copy /etc/awstats/awstats.servername* (ftp / mail / web)
<pre>
run the statisticsrun in /etc/logrotate.d/apache2 by hand to see how it all goes!
<pre>
cp /opt/weblog/src/weblog_files/graphs/ /home/sites/USGP.tripany.com/site/webloggraphs/ -R

shorewall (see knowledgebase page)

postfix edits (knowledgebase)

postmap virtual

postmap transport


vi /etc/procmailrc

#Procmailrc modified by RazoR
#
MAILDIR=/var/spool/mail
LOGFILE=/var/log/mail/procmail
LOGABSTRACT=all
VERBOSE=off
LOG=$date

touch /var/log/mail/procmail

logrotate procmail in the /etc/logrotate.d/rsyslog file

ln -s /home/spool/mail/ /var/mail

edit /etc/syslogd.conf to log stuff to /var/log/mail

mail.info                       -/var/log/mail/mail.info
mail.warn                       -/var/log/mail/mail.warn
mail.err                        /var/log/mail/mail.err

FOR OLD SYSLOG BEHAVIOUR

!popa3d
*.*                             /var/log/mail/popa3d.log

FOR RSYSLOG

in /etc/rsyslog.d/popa3d.conf

if $programname == 'popa3d' and $syslogseverity <= '6' then /var/log/mail/popa3d.log
if $programname == 'popa3d' and $syslogseverity <= '6' then ~

spamassassin (knowledgebase page)

webmail (knowledgebase)

change the mysql password

set up disk quotas

backup scripts