diff --git a/README.md b/README.md index 1a0bc48..5123107 100755 --- a/README.md +++ b/README.md @@ -1,46 +1,41 @@
www.victorwesterlund.com
The source code for victorwesterlund.com
+This guide is for Unix-based systems with NGINX, PHP 8.0 and MariaDB installed and configured.
-git clone https://github.com/VictorWesterlund/victorwesterlund.com /var/www
/public
to the web.location
block or symlink should do the trick.api.php
to api/*
.example.com/api/*
should be routed to the PHP file at /src/api.php
.location ~ /api/* { - try_files /src/api.php =503; - include snippets/fastcgi-php.local.conf; - fastcgi_pass unix:/run/php/php8.0-fpm.sock; -}
.mjs
extension..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
.sql
can be downloaded here and imported into a database with this command:mysql -u username -p database_name < db_structure.sqlYou will have to create an empty database if you don't have one already.
/src/database/config.json
.
-{
- "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 🤞
+ +## Local installation + +If someone for whatever reason want to set up their own environment of this. Here's how you do so assuming you have [NGINX](https://nginx.org/en/) up and running: + +1. **Clone this repo** + +``` +git clone https://github.com/VictorWesterlund/victorwesterlund.com +``` + +2. **Create an NGINX site config** + + Create and enable a new site + server config with the `root` pointed to the **/public** folder inside the repo. + +3. **Add support for `.mjs`** + + I'm using the hyped .mjs extension for the ES modules and NGINX does not serve the correct MIME-type for these yet. + + Open **/etc/nginx/mime.types** with your text editor of choice and add `mjs` to the `application/javascript` MIME-type. Save and exit. + + ``` + types { + ... + application/javascript js mjs; + ... + } + ``` + *Psst: if you shiver at the sight of JS using another type than your HTML:s and CSS:ess (you are my kind of nerd), replace **application/javascript** with **text/javascript** and remain [WHATWG compliant](https://mimesniff.spec.whatwg.org/#javascript-mime-type)😚* + +4. **Fire up NGINX with the new config** + + Verify that your changes are valid and restart NGINX. Hop over to your browser and navigate to your set endpoint - fingers crossed 🤞 + ``` + nginx -t + sudo systemctl restart nginx + ```