Simple static website

A static website is just a few html files delivered by httpd. It's safe and fast. That's a good starting point. Let's see how to host you own website.

First, create a directory to store the website :

# mkdir /var/www/htdocs/my_website

Now, copy your website html pages and files in that directory (index.html...). Just make sure httpd is able to read those files by adjusting permissions with "chmod a+r /var/www/htdocs/my_website" or setting owner :

# chown -R www:daemon /var/www/htdocs/my_website

You might change permissions later.

Now you must configure httpd to add a new section for you website. If it is served on "http://athome.tld", you'll edit "/etc/httpd.conf" file so it looks like this :

types { include "/usr/share/misc/mime.types" }
server "athome.tld" {
	listen on * port 80
	root "/htdocs/my_website"

A few notes about the previous lines :

You can now enable and start httpd :

# rcctl enable httpd
# rcctl start httpd

Check http port (80) is open in your router and firewall, then check your website is reachable.

Every file you add in "/var/www/htdocs/my_website" will be served.

You can use SFTP previously described to upload your website 😉.