- Replace $EUID with $(id -u) for root checks across all bin/*.sh and install.sh: dash (Debian's /bin/sh) never sets $EUID, so the check was silently broken everywhere. - lemp.sh: make apt-get upgrade non-interactive (--yes), align the Redis PHP module and php-fpm restart with $PHP_VERSION instead of a hardcoded 8.1, and template the nginx PHP-FPM socket path via a PHP_FPM_SOCK placeholder substituted at install time. - nginx-phpmyadmin.conf: fix docroot to match the actual phpMyAdmin symlink location created by lemp.sh. - mysql-db.sh: inline the root check instead of sourcing the nonexistent bin/checkroot.sh. - webhook.sh: fix chowm typo (chown). - urbackup.sh: copy the systemd unit from assets/ instead of a relative path to a file that doesn't exist in the repo. - _addUserSite.sh: fix invalid `$var=value` assignment and an empty if-block that was a POSIX sh syntax error. Also carries over pending fixes to deploy-drupal.sh (drush now invoked via vendor/bin/drush) and gitbarrerepos.sh (comment cleanup). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Install LEMP web server and secure it on debian 12
Fail2ban, Ufw, Proftpd, Knockd, Nginx, Mariadb, php7.0-fpm, redis, vhosts, git barre repos, zabbix-agent, dotfiles and more
how to use it
on a fresh install
All commands below are run as root user. Either log in as root user directly or log in as your normal user and then use the command su - to become root user on your server before you proceed. IMPORTANT: You must use su - and not just su, otherwise your PATH variable is set wrong by Debian.
1 install git
apt-get install git
2 clone the repo
git clone https://figureslibres.io/gogs/bachir/debian-web-server.git
3 change defaut shell from dash to bash
dpkg-reconfigure dash
and answer NO to the the question
4 run the script as root
su
cd debian-web-server
chmod a+x install.sh
./install.sh
5 steps
- misc.sh
- dotfliles.sh
- user.sh
- ssh.sh
- firewall.sh
- fail2ban.sh
- email.sh
- lemp.sh
- mysqlbackup.sh
- vhost.sh
- gitbarrerepos.sh
- webhook.sh
- urbackup.sh
- zabbix.sh
ref
http://www.debian.org/doc/manuals/securing-debian-howto/ https://www.thefanclub.co.za/how-to/how-secure-ubuntu-1204-lts-server-part-1-basics https://www.linode.com/docs/websites/lamp/lamp-server-on-debian-7-wheezy https://www.evernote.com/Home.action#n=28425519-ee9f-4efc-a13b-5426f4b31a78&ses=1&sh=5&sds=5&x=git%2520deploy& https://github.com/Mins/TuxLite