Nginx ===== High performance web server .. role:: bash(code) :language: bash Installation ------------ Hugh installed, presumably ``brew install nginx`` Storage & Configs ----------------- Web roots in ``/Volumes/Data/www/{domain}`` Config in ``/opt/homebrew/etc/nginx/`` and ``/opt/homebrew/etc/nginx/sites-enabled/`` Operation --------- Homebrew stuff is installed and runs under the user ``hugh`` so ``sudo su -l hugh`` before poking nginx... and **don't forget the -l flag!** Test configs with ``/opt/homebrew/bin/nginx -t`` (as user hugh!) To reload after changing configs, run (as hugh) ``brew services restart nginx`` php-fpm ------- Runs on 127.0.0.1:9000, config in ``/opt/homebrew/etc/php/8.3/php-fpm.conf`` and ``/opt/homebrew/etc/php/8.3/php-fpm.d/www.conf`` PHP 8.3 is a lot fussier about type-hinting function arguments and return values, which causes all kinds of issues with legacy code (including Seme4 Platform). There's a script ``php8-fixes.php`` that crudely changes some stuff to fix errors and shut up the warnings... it's a bit of a horror show and prob needs revisiting in the course of time. Shout if you see any deprication warnings in use! SSL --- Obtain certificates via :doc:`letsencrypt ` You need the following lines (as a minimum) in the domain's nginx config. See ragld.com for a simple example. .. code:: bash server { listen 443 ssl; server_name domain.tld www.domain.tld; # SSL certificate paths ssl_certificate /etc/letsencrypt/live/domain.tld/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/domain.tld/privkey.pem; ssl_trusted_certificate /etc/letsencrypt/live/domain.tld/chain.pem; # Root directory root /Volumes/Data/www/Sites/domain.tld; # standard vhost, including PHP include vhost.conf; }