Table of Contents

1. Things you can do with your ~/publichtml

1.1. What is a userdir?

The apache config now has a UserDir directive which means that it will serve content that's located in your ~/publichtml directory. To access any files that you place in there all you need to do is go to archlinuxuser.online/~<username>/<my-html-file.html>.

1.2. Serve static content

You can just put files in your ~/publichtml and they will get picked up immediately.

Here's what mine looks like.

~/public_html$ ls -R1
index.html
style.css
test

./test:
test.html

You can view this website at https://archlinuxuser.online/~jordan/

Here's what the index.html looks like

<!-- ./index.html -->
<html>
        <head>
                <link rel="stylesheet" href="style.css">
        </head>
        <body>
                <h1>Hello world</h1>
                <p>UserDir works, yay!</p>
        </body>
</html>

Here's the style.css that index.html refers to.

/* ./style.css */
body {
    background-color: burlywood;
}

1.3. Serving static content that you've generated

Managing lots of pages manually can be difficult so someone invented static site generators. A static site generator will take in a number of posts written in an easier to edit format like markdown and use them create a website with everything nicely laid out with a theme and maybe even an rss feed.

Whichever static site generator you end up using the result should be a folder whose contents you can serve on a static webserver. All these files can be uploaded to ~/publichtml.

A command like the following should serve well for most purposes. Tailor it to your needs and look in the man page for rsync for help

rsync --delete -rav -e "ssh -p <yourportgoeshere>" website/ user@archlinuxuser.online:public_html

Author: Jordan Russell

Created: 2023-03-06 Mon 17:35

Validate