Setting Up a Website
This guide explains how to configure httpd(8) to serve a website.
Before You Begin
This guide assumes you have already correctly configured OpenHTTPd and set up TLS.
Finding the Document Root
First, put files in your document root. You'll want to check your httpd.conf(5) for the document root. For example, consider this block:
server "example.com" { listen on * tls port 443 tls { certificate "/etc/ssl/example.com.crt" key "/etc/ssl/private/example.com.key" } location "/pub/*" { directory auto index } location "/.well-known/acme-challenge/*" { root "/acme" request strip 2 } }
In this example, the only document root declared in the configuration is in
line 11, for ACME verification. This is normally not where webpages are
served. So, since the document root for webpages is not specified,
httpd(8) defaults to using /htdocs
.
Since OpenHTTPd runs in a chroot by default, this means your
files should go in /var/www/htdocs/
.
Creating a Webpage
We can create our first webpage by editing /var/www/htdocs/index.html
.
Save this page, and make sure it is readable:
# chmod a+r /var/www/htdocs/index.html
Then, load https://example.com/index.html
in your web browser to view.
Remember to replace example.com
with your actual hostname.
Web applications
Here are some sample web applications you can install:
Name | Type |
---|---|
pmwiki | wiki |
CVSWeb | CVS Code Hosting |
Gotweb | Got code hosting |
Fiche | Pastebin |
Squirrelmail | Webmail |
You can find more web applications in the Almanack.