mirror of
https://codeberg.org/vlw/victorwesterlund.com.git
synced 2025-11-05 05:32:42 +01:00
Source code for victorwesterlund.com
|
|
||
|---|---|---|
| public | ||
| src | ||
| .gitignore | ||
| LICENSE | ||
| README.md | ||
How to install
This guide is for Unix-based systems with NGINX, PHP 8.0 and MariaDB installed and configured.
- Clone this repo.
git clone https://github.com/VictorWesterlund/victorwesterlund.com /var/www
- Expose the directory
/publicto the web.
This can be done in multiple ways, but an NGINXlocationblock or symlink should do the trick. - Rewrite
api.phptoapi/*.
All requests toexample.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; } - Add support for the
.mjsextension.
NGINX doesn't have an entry for the ECMAScript module (.mjs) file extension in its default/etc/nginx/mime.typesfile. We need to add this manually:
types { ... application/javascript js mjs; ... }PS: If you want to make yourContent-TypeWG compliant, replaceapplication/javascriptwithtext/javascript - Import the standard structure to a MariaDB database.
A MySQL-compatible.sqlcan 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. - 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 🤞