| | +# Requirements |
| | + |
| | +Before installing TreeTrek, ensure your server environment meets the necessary software and OS specifications. The application relies on specific versions of PHP, Nginx, and Git to function correctly. |
| | + |
| | +* Linux (Tested on Debian GNU/Linux 6.12.69). |
| | +* nginx (v1.26.3 or compatible). |
| | +* PHP 8.4.16 or higher (using PHP-FPM). |
| | +* Git 2.53.0 or higher |
| | + |
| | +# Installation |
| | + |
| | +To install: |
| | + |
| | +* Download code |
| | +* Configure settings |
| | +* Configure web server routing and security |
| | +* Define display order |
| | + |
| | +Replace placeholder values with the configuration details. |
| | + |
| | +1. Set placeholders: |
| | + ``` bash |
| | + export REPO=repo.domain.com |
| | + export OWNER=username |
| | + export WEBDIR=/var/www |
| | + ``` |
| | +1. Run: |
| | + ```bash |
| | + mkdir -p /var/www/${REPO} |
| | + cd /var/www/${REPO} |
| | + git clone [https://repo.autonoma.ca/repo/treetrek](https://repo.autonoma.ca/repo/treetrek) |
| | + sudo usermod -aG ${OWNER} www-data |
| | + ``` |
| | +1. Edit `${WEBDIR}/${REPO}/Config.php`. |
| | +1. Set `SITE_TITLE`. |
| | +1. Set `REPOS_SUBDIR`. |
| | +1. Save the file. |
| | +1. Edit `${WEBDIR}/${REPO}/order.txt` |
| | +1. Add repositories you want to come first, hide using a hyphen prefix. |
| | +1. Edit nginx configuration file. |
| | +1. Add routing and security rules: |
| | + ```nginx |
| | + location ^~ /images/ { |
| | + allow all; |
| | + } |
| | + |
| | + location ~* ^/images/.*\.svg$ { |
| | + add_header Content-Type image/svg+xml; |
| | + } |
| | + |
| | + location ~ ^/(git|pages|render)/ { |
| | + deny all; |
| | + return 403; |
| | + } |
| | + |
| | + location ^~ /repo/ { |
| | + try_files $uri $uri/ /index.php?$query_string; |
| | + } |
| | + |
| | + location / { |
| | + try_files $uri $uri/ /index.php?$query_string; |
| | + } |
| | + |
| | + location = /index.php { |
| | + include snippets/fastcgi-php.conf; |
| | + fastcgi_pass unix:/run/php/php8.4-fpm.sock; |
| | + } |
| | + |
| | + location ~ \.php$ { |
| | + deny all; |
| | + return 403; |
| | + } |
| | + ``` |
| | +1. Apply changes: |
| | + ```bash |
| | + sudo nginx -t && sudo systemctl reload nginx |
| | + ``` |
| | + |
| | |