User:Paul/sandbox/Configure OpenBSD web server

From UNPM.org Wiki
< User:Paul
Revision as of 03:13, 18 December 2020 by Paul (talk | contribs) (Created page with "The OpenBSD project includes two powerful web server tools installed by default called <code>relayd</code> and <code>httpd</code>. Most web server requirements are fairly simp...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The OpenBSD project includes two powerful web server tools installed by default called relayd and httpd. Most web server requirements are fairly simple and straightforward, so OpenBSD created httpd to meet these requirements. It can easily serve the vast majority of HTML, PHP, file serving, and other basic web server needs. More advanced server requirements such offloading server duties to a different server can be fulfilled by making use of a reverse proxy, and this is where relayd plays a role.

Configuration

The below configuration will use both relayd and httpd for serving websites. Although it is one extra step, once configured, it is trivial to make use of relayd in front of httpd, but can make server reconfiguration very easy in the event a site being served is using more resources than the server can handle. In such an event, it is trivial to place another server and point relayd at it. It can also be useful for serving projects that cannot be served through httpd, such as Anarki.

Configure httpd

Directory tree

servername /home/username
$ doas mkdir /var/www/sites/
servername /home/username
$ doas chown root:daemon /var/www/sites/
servername /home/username
$ doas chmod 775 /var/www/sites/
servername /home/username
$ doas mkdir /var/www/sites/example.com
servername /home/username
$ doas mkdir /var/www/sites/example.com/{backup,logs,private,public}
servername /home/username
$ doas chmod -R 775 /var/www/sites/
servername /home/username
$ 
servername /home/username
$