Difference between revisions of "User:Paul/sandbox/Configure OpenBSD web server"

From UNPM.org Wiki
Jump to navigation Jump to search
(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...")
 
Line 25: Line 25:
 
  servername /home/username
 
  servername /home/username
 
  $
 
  $
 +
 +
== Logging ==
 +
 +
The configurations in this article disable most logging functions for both <code>relayd</code> and <code>httpd</code>. For an enthusiast, logging is generally only useful when running web traffic analytics tools, such as Matomo or AWStats, or when troubleshooting issues related to the web server.
 +
 +
To enable logging

Revision as of 16:29, 20 December 2020

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
$

Logging

The configurations in this article disable most logging functions for both relayd and httpd. For an enthusiast, logging is generally only useful when running web traffic analytics tools, such as Matomo or AWStats, or when troubleshooting issues related to the web server.

To enable logging