Currently a static webserver run on a LEMP stack (Linux, Nginx, MySQL, PHP).
- Install and Set Up MariaDB
- Make sure to follow ALL the steps, including creating an admin account with a password (?)
- Create a new database on the MariaDB server named "website"
sudo mysql
CREATE DATABASE website;
- Run
sudo mysql website < database/backup.sql
- (you can create a dump with
sudo mysqldump website > database/backup.sql
)
- (you can create a dump with
sudo apt install nginx
sudo apt install php7.4-common php7.4-cli php7.4-fpm php7.4-mysql php7.4-curl php7.4-mbstring php7.4-xml
(might be different php versions for your dist)- Install Composer Dependencies
chmod +x install_composer.sh && ./install_composer.sh
- Within /etc/nginx/sites-available/default:
index index.html index.htm
->index index.php index.html index.htm
- Uncomment object labeled as
location ~ \.php$ {
- Re-comment line
fastcgi_pass 127.0.0.1:9000
- To add custom error pages, add these lines:
error_page 404 /index.php?page=404;
error_page 403 /index.php?page=403;
error_page 500 /modules/error_pages/500.html;
error_page 503 /modules/error_pages/503.html;
- For extra security, add
deny all;
underneath two location objects that look likelocation ~ composer {
andlocation ~ vendor {
- Set global PHP params:
- Fill out
php-params.conf.example
with the appropriate secrets, rename it tophp-params.conf
, and place it in the/etc/nginx/snippets
directory - Within /etc/nginx/sites-available/default, add the line
include snippets/php-params.conf;
inside thelocation ~ \.php$ {
block
- Fill out
- Copy frontend folder to /var/www/html (or system equivalent default webroot)
sudo systemctl restart php7.4-fpm
sudo nginx -t
andsudo systemctl restart nginx
Your website should now be live at localhost:80 To get an ssl cert, use certbot: https://certbot.eff.org/
- Within /etc/nginx/sites-available/default:
- add
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=6r/m;
outside everything - add a new location, identical to the
location ~ \.php$ {
directive, but specified aslocation = /modules/submit/result.php {
- add
limit_req zone=mylimit;
insidelocation = /modules/submit/result.php {
- add
- Currently using Cloudflare for domain protections. Can actually create a tunnel to cloudflare without opening ports on our local server.
- https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide/local/
- https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide/local/as-a-service/linux/
I've created a script to simplify the process of creating a new post. Simply create a new markdown file in posts/
, then run generate_new_post.py
.
pip3 install mysql-connector-python
python3 generate_new_post.py
- Rotate daily fact every day
- Add a guestbook
- Add more songs
LINKS TODO:
-
https://aesthetic.computer/ (add to list of things to do)