Details: Setting up a Web Server

The first server I attempted to set up on my designated computer was a web server to serve a few websites I previously had paid others to host. I started by setting up the most popular Linux web server called apache2. I set it up to serve webpages using the http (non-secure) protocol. I thought it would be relatively easy to then configure it for the https (secure) protocol, and indeed it was. A serious problem I found was that one of my websites depended heavily on php, but I could not get php7.3 to work with https: the former required enabling the apache2 mpm_prefork module in order to work, and the latter would not work with the mpm_prefork module enabled.

I thus gave up on using the apache2 web server and instead installed the second most-popular Linux web server, nginx. This too proved relatively easy, and directions for getting php to work with nginx are found here.

The general configuration files for apache2 are placed in /etc/apache2, while those for nginx are placed in /etc/nginx. Both programs make use of two subdirectories where the configuration files for each virtual-server goes. I am sure the word virtual-server has some important signifance that is beyond me, but a virtual-server in the old days, would simply have been called a website. So, each website you might want to host must have a configuration file in the sites-available subdirectory. The sites-enabled subdirectory should contain a link to a configuration file in the sites-available subdirectory for every website you want to be served. I believe the site-configuration files for the apache2 server are meant to end with the suffix, ".conf", whereas I know that those for the nginx server need not. You may download from this website two sample configuration files, one configured to allow only secure (http2/https) traffic, and one configured to allow both secure (http2/https) and non-secure (http) traffic. As of 1 May 2020, the links containing the configuration files have not yet been posted.

If you want to serve your webpages using http2/https, you will have to install a security certificate. There are paid certificates that come with installation instructions that you can buy, or you can install the free LetsEncrypt certificate using your linux system's installer. I will not tell you precisely how to install a LetsEncrypt certificate because the instructions seem to change frequently. This is not a serious problem because each iteration of updated instructions seems to make the installation and maintenance of the certificate less burdensome. I will just point out a few simple things to help you along. The first simple point is that the terms LetsEncrypt, Certbot, and ACME challenge all pertain to installing LetsEncrypt certificates. I think with current usage, LetsEncrypt is the name of the certificate, certbot is the name of a python3 program that installs and maintains the certificate, and ACME is an organization that performs certain checks during the installation or maintenance steps. The second simple thing that obious but easy to forget, is that if you have more than one computer on your network, make sure you install the software and issue the installation or maintenance commands on the same computer on which the server software is installed.

Return to menu     Next in series    

| Emmes Technologies Home |


Last updated 10 May, 2020