Prerequisites
- A Debian 8 server (Jessie) with root or sudo privileges
- An up-to-date package index:
sudo apt-get update
Bash1. Installing Nginx from Debian’s Default Repositories
Debian 8 ships with Nginx 1.6.2 in its main repository. To install it:
sudo apt-get install nginx-full -y
BashThis will pull in Nginx and all its core modules, giving you version 1.6.2 out of the box.
Once installation completes:
# Start Nginx
sudo systemctl start nginx
# Enable it to start on boot
sudo systemctl enable nginx
# Verify it’s running
sudo systemctl status nginx
BashVisit http://<your_server_ip>/ in a browser; you should see the default “Welcome to nginx!” landing page.
2. Installing a More Recent Nginx via Dotdeb
If you need a later Nginx release (for example, 1.12.x or newer), you can pull packages from the Dotdeb and Nginx.org repositories. Here’s a one-shot script to add both repositories, trust their GPG keys, and install:
# 1. Add Dotdeb and Nginx.org sources
sudo tee -a /etc/apt/sources.list <<EOF
deb http://packages.dotdeb.org jessie all
deb http://nginx.org/packages/mainline/debian/ jessie nginx
EOF
# 2. Import the signing keys
cd /tmp
wget http://www.dotdeb.org/dotdeb.gpg
sudo apt-key add dotdeb.gpg
wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
# 3. Update package lists and install
sudo apt-get update
sudo apt-get install nginx-full -y
BashAfter this, you’ll have Nginx 1.12.2 (or whatever the current mainline version is).
Confirm the version:
nginx -v
Bash3. Post-Installation Steps
- Firewall configuration
Ensure HTTP (80) and, if needed, HTTPS (443) are allowed through your firewall.sudo ufw allow 'Nginx Full'
- Basic configuration test sudo nginx -t A successful output means your syntax is correct.
- Reload on changes
Whenever you tweak/etc/nginx/nginx.conf
or any files in /etc/nginx/sites-available/, apply them with:
sudo systemctl reload nginx
BashConclusion
You now have Nginx up and running on Debian 8—either the stable stock release or a more bleeding-edge version via Dotdeb. From here, you can:
- Configure virtual hosts in
/etc/nginx/sites-available/
- Enable SSL/TLS via Let’s Encrypt
- Tune performance with worker processes, caching, and gzip compression
Enjoy the speed and flexibility of Nginx on Debian 8!
Installing PHP 8.3 on Debian 8 requires a bit more effort, as it’s not included in the default repositories. To get the latest PHP version, you can leverage third-party repositories such as ondrej/php, which provides up-to-date PHP packages for Debian and Ubuntu.
First, install the necessary prerequisites:
apt-get update
apt-get install -y apt-transport-https lsb-release ca-certificates curl
Bash
Next, add the ondrej/php PPA (Personal Package Archive) to your system:
curl -fsSL https://packages.sury.org/php/.gpg | sudo apt-key add -
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
apt-get update
Bash
Now, install PHP 8.3 and essential modules:
apt-get install -y php8.3 php8.3-fpm php8.3-mysql php8.3-xml php8.3-mbstring php8.3-curl
BashOnce installed, enable the PHP 8.3-FPM service and restart Nginx to apply changes:
systemctl enable php8.3-fpm
systemctl restart php8.3-fpm
systemctl restart nginx
Bash
Verify your PHP version:
php -v
Bash
You should see PHP 8.3.x displayed, confirming the installation. Now, your server is equipped with the latest PHP version, ready to serve dynamic PHP websites with Nginx on Debian 8.