ubuntu server: setup website

by prettyscripts on 2008-03-22 16:14:38

unix

copy files to destined directory.

go to /etc/apache2/sites-availabe, edit the ’site’ file. the default is ‘default‘.

if creating a new site file, after creating and editing the file, run sudo a2ensite file. to disable the site, run sudo a2dissite file.

after the site file is edited and saved. run sudo /etc/init.d/apache2 restart.

now use the browser to go to the website. it should be there.

editing the site file

add <VirtualHost> tag for the new site. the content:

Code:

<VirtualHost *>
        ServerAdmin email_address
        ServerName domain.com
        ServerAlias *.domain.com
  
        DocumentRoot /full/path/to/your/website
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
  
        ErrorLog /var/log/apache2/error.domain.log
  
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn
  
        CustomLog /var/log/apache2/access.domain.log combined
        ServerSignature On
</VirtualHost>

some explanations

2 - any server problem will report to this email address (not sure if this works, but that’s what official doc says).
3 - website domain
4 - any prefix to the domain will be directed here. eg www.domain.com or anything.domain.com.
6 - the full path to your website.
12 - where errors are log. by default it’s error.log. add a name to distinguish which site the error comes from. this is purely personal preference.
18 - where access to the site are logged. file name, same reason as above.

for further detail, read this.

Tags: apache, setup, unix

No feedback yet

Leave a comment


Your email address will not be revealed on this site.
PoorExcellent
note: all comments are moderated. do not spam and do not advertise. only comments relevant to the post will be published.
(Line breaks become <br />)
(For my next comment on this site)
(Allow users to contact me through a message form -- Your email will not be revealed!)