Apache2 Excercise

Installed Apache2 HTTP Server on my Ubuntu server. Command was: sudo apt-get install apache2.

If I wanted to reinstall apache2 i would type in: sudo apt purge apache2 .

Useful commands for using apache2:
apache2ctl start
apache2ctl restart
apache2ctl stop
apache2ctl fullstatus or
systemctl start apache2
systemctl restart apache2
systemctl stop apache2
systemctl status apache2


/etc/apache2/apache2.conf is the main configuration file. mods-available contains all modules and mods-enabled contains modules which are currently in use. Modules can be enabled with a2enmod command. file “envvars” is default environment variables for apache2ctl.

I created a www-page named “testing.html” in /var/www/html.
I can reach the site by typing my apache servers ip address to browsers search bar and /testing.html after the ip.

Userdir module allows user-specific directories to be accessed using the http://example.com/~user/ syntax.

To enable it: a2enmod userdir
To disable it: a2dismod userdir

Restarting the apache2 is done by typing in: systemctl restart apache2

Public_html directory is for normal users to create their own web page.

Copy file: default-ssl.conf > /sites-enabled/
Generating RSA key: openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key

Warning message from browser.

I could get a free SSL certificate from Let’s Encrypt project, but first I would have to register a domain name, because Let’s Encrypt certificate authority will not issue certificates for a bare IP address.

One thought on “Apache2 Excercise

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s