Mike Cho Development

Set up a website in apache2/ubuntu


  1. Make a directory /var/www/html/my_site
  2. Edit hosts file /etc/hosts ( www.my_site.loc)
  3. Make virtual host entry in /etc/apache2/sites-available/my_site.conf
  4. Activate site with a2ensite – sudo a2ensite my_site.conf
  5. Change owner of directory to www-data
  6. Change permissions of directories to 755
  7. Restart apache with sudo systemctl restart apache2


Create directory
mkdir /var/www/html/my_site

edit hosts file
sudo nano /etc/hosts

edit virtual host
sudo nano /etc/apache2/sites-available/my_site

ServerName normal_local_site.loc ServerAlias www.normal_local_site.loc DocumentRoot /var/www/html/normal_local_site ErrorLog ${APACHE_LOG_DIR}/normal_local_site.error.log CustomLog ${APACHE_LOG_DIR}/normal_local_site.access.log combined AllowOverride All

activate site
sudo a2ensite my_site

check configuration
apachectl configtest

outputs information
apachectl -S

Change owner of website directory
$ sudo chown -R www-data:www-data /var/www/html/my_site

change permissions
sudo chmod -R 775 /var/www/html/my_site

download and unzip wordpress
wget -c http://wordpress.org/latest.tar.gz

$ tar -xzvf latest.tar.gz

restart apache
sudo service apache2 restart
sudo systemctl restart apache2