User Tools

Site Tools


apache:install_apache

Apache - Install Apache

Install Apache

apt-get update
apt-get install apache2

Disable the default site

a2dissite 000-default
service apache2 reload

Create a directory for the website

mkdir -p /var/www/example-site/

Populate the website directory

Place the actual html files etc. into the website directory.

Alternatively, populate the directory from another source, such as:

git clone https://github.com/example/example-site.git
cp -r example/* /var/www/example-site

Set website directory permissions

chown -R www-data:www-data /var/www/example-site

Create a config file for the website

Base the config file on the default config file.

cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example-site.conf

Modify the config file for the website

vi /etc/apache2/sites-available/example-site.conf

between

<VirtualHost *:80>
  ServerName example-site
  DocumentRoot /var/www/example-site
</VirtualHost>

Enable the website

a2ensite example-site.conf
service apache2 reload

Try accessing the website

Within a web-browser enter

http://example-site

apache/install_apache.txt · Last modified: 2022/06/14 09:14 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki