In a world where every piece of software is filled with scope creep, bloat, and unneeded complexity, it can be refreshing to have a website that is simple and straightforward. In this article, we will explore how to set up a website using Python 3, HTML, and Pandoc.
The website in question will be pretty similar to mine, and can be a pretty good starting point for everybody with some programming experience.
Contents
Prerequisites
- A text editor
- Python 3.12
- Pandoc
- A VPS running Debian, or GitHub pages (although I am using the former)
- Git
- Some domain, or GitHub page’s
Setting up Apache2
For people on GitHub pages, skip this section.
Apache2 (Apache hereafter) is the most popular web server out there - it is ubiquitous, versatile, and has a pretty straight-forward configuration.
Install it with:
# yes | apt-get install apache2Debian’s default Apache2 configuration is pretty bland, but it is a
pretty good starting point. Open
<your server host>:80 in your browser, and you should
see a page with a header that says “It works!”.
Now, we’ll add a virtual host for our website. Create a file called
/etc/apache2/sites-available/<your full hostname>.conf
(for me, it is
/etc/apache2/sites-available/mariorosell.es.conf) with the
following content:
<VirtualHost *:80>
ServerName mariorosell.es
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
RewriteCond %{SERVER_NAME} =mariorosell.es
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>NOTE: Do NOT delete the default config
(We’ll then expand this to support HTTPS with
certbot, for now stick to HTTP.)
Now make