5

I've installed Ubuntu 10.04 LAMP server. The only (in addition to all the standard technical users created by installation) user is "administrator" (should I create more?). I doubt it is correct to place public websites to /home/administrator/public_html/. What is the correct place? I am going to use Apache's Name-based Virtual Host Support to host multiple websites.

Ivan
  • 55,987
  • 65
  • 150
  • 212

1 Answers1

5

That depends a lot on what you think is good.

Personally i have two lamp's running several sites and they use the following setup:

/var/www/domain.tld/subdomaine
/var/www/domain.tld/subdomaine-log

Real life example:

<VirtualHost *:80>
    ServerAdmin hostmaster@sourcelab.dk
    ServerName sourcelab.dk
    ServerAlias www.sourcelab.dk *.sourcelab.dk

    DocumentRoot /var/www/sourcelab.dk/www
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>

    <Directory /var/www/sourcelab.dk/www>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

    ErrorLog /var/www/sourcelab.dk/www-log/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/www/sourcelab.dk/www-log/access.log combined
    ServerSignature On
</VirtualHost>

If you use this setup it might be a good idea to alter /etc/logrotate.d/apache2 just prepend lines like this "/var/www/sourcelab.dk/www-log/*.log" to the file.

/var/www/sourcelab.dk/www-log/*.log
/var/log/apache2/*.log {
    weekly
    missingok
    rotate 52
    compress
    delaycompress
    notifempty
    create 640 root adm
    sharedscripts
    postrotate
            if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then
                    /etc/init.d/apache2 reload > /dev/null
            fi
    endscript
}

This will make logrotate rotate the log-files once a week and keep a backlog of 52 times one week. This will help you avoid filling your HDD with logfiles and it helps you if you ever need something from the logfiles. I recently trawled through a 5GB postfix mail logfile... NOT FUN!

LassePoulsen
  • 14,517
  • 8
  • 47
  • 59