Source code for victorwesterlund.com
Find a file
Victor Westerlund 0cd5d11cd8 Squashed commit of the following:
commit 17b429555fceefc9c3500ddee4da8c6902d9674a
Author: Victor Westerlund <victor.vesterlund@gmail.com>
Date:   Tue Dec 28 01:00:11 2021 +0100

    Optimize assets and pages

commit c05e4bb5eabd9ef2b96eccb347cc0399cb6869f8
Author: Victor Westerlund <victor@victorwesterlund.com>
Date:   Tue Dec 14 18:06:52 2021 +0100

    Add noopener link type

    Prevents Spotify from accessing the window object of victorwesterlund.com.
    I think sending the referrer header is fine so noreferrer is not needed

commit cc3cca09ac02cc0bf45204bbe52dcc20ee10a2eb
Author: Victor Westerlund <victor.vesterlund@gmail.com>
Date:   Sun Dec 12 15:56:05 2021 +0100

    Add desktop style

    Added the desktop overrides as media queries for a mobile-first approach. Also added the "more" and "contact" pages.

commit de6f30a7c2525e5bb7a31a55f11a40fc33347f85
Author: Victor Westerlund <victor.vesterlund@gmail.com>
Date:   Sun Dec 12 14:46:21 2021 +0100

    New content and CSS refactor

    Content template for "more" and major CSS refactor
2021-12-28 01:01:26 +01:00
public Squashed commit of the following: 2021-12-28 01:01:26 +01:00
src Core functions compartmentalized 2021-12-01 17:07:47 +01:00
.gitignore Added to .gitignore 2021-09-30 06:32:15 -04:00
LICENSE Create LICENSE 2021-05-10 18:52:40 +02:00
README.md Add back-end core and "search" feature (#20) 2021-11-03 11:10:50 +01:00

www.victorwesterlund.com

The source code for victorwesterlund.com

How to install

This guide is for Unix-based systems with NGINX, PHP 8.0 and MariaDB installed and configured.

  1. Clone this repo.
    git clone https://github.com/VictorWesterlund/victorwesterlund.com /var/www
  2. Expose the directory /public to the web.
    This can be done in multiple ways, but an NGINX location block or symlink should do the trick.
  3. Rewrite api.php to api/*.
    All requests to example.com/api/* should be routed to the PHP file at /public/api.php.
    Just like the previous step, this can be done in multiple ways. Here is one way with an NGINX location block:
    location ~ /api/* {
         try_files /public/api.php =503;
         include snippets/fastcgi-php.local.conf;
         fastcgi_pass unix:/run/php/php8.0-fpm.sock;
    }
  4. Add support for the .mjs extension.
    NGINX doesn't have an entry for the ECMAScript module (.mjs) file extension in its default /etc/nginx/mime.types file. We need to add this manually:
    types {
         ...
         application/javascript                js mjs;
         ...
    }
    
    PS: If you want to make your Content-Type WG compliant, replace application/javascript with text/javascript
  5. Import the standard structure to a MariaDB database.
    A MySQL-compatible .sql can be downloaded here and imported into a database with this command:
    mysql -u username -p database_name < db_structure.sql
    You will have to create an empty database if you don't have one already.
  6. Add your MariaDB connection details to /src/database/config.json.
    You can add as many fallback servers as you want
    {
      "servers": [
          {
             "host": "db.example.com",
             "user": "mysql_user",
             "pass": "mysql_pass",
             "db": "mysql_db"
          },
          {
             "host": "fallback.db.example.com",
             "user": "mysql_user",
             "pass": "mysql_pass",
             "db": "mysql_db"
          }
      ]
    }
    

That was a lot, but now we're done! Navigate to the location you exposed in step 2 and cross your fingers 🤞