Arama Yap Mesaj Submit
Request a Callback
+90
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro

Contact Us

Location Halkali merkez neighborhood fatih st ozgur apt no 46 , Kucukcekmece , Istanbul , 34303 , TR
Last technical review · 17.08.2026 · Ubuntu 26.04 Web Server

Ubuntu 26.04 Production Web Stack: Nginx + PHP-FPM + TLS + Rollback

“Nginx is installed and PHP works” is not a production definition. DNS, TLS, FPM sockets, deployment layout, logs, health checks and rollback must form one observable chain.

Production note

PHP-FPM version and socket path depend on installed packages. Inspect `/run/php/` instead of blindly copying an example socket path.

ubuntu 26.04 nginx php fpmubuntu 26.04 web servernginx php production
TECHNICAL IMPLEMENTATION PROFILE
EKA CORE
Ubuntu 26.04 Web Server

Validate the app locally over HTTP first, then add domain and TLS. For 502 errors check PHP-FPM socket/upstream before DNS; for TLS failures verify DNS and ports 80/443 before application code.

80/443Public web ports
Checked
/run/php/FPM discovery path
Checked
nginx -tRelease gate
Checked
Health URLApplication signal
Checked
Technical guide · production-focused · official sources
Quick answer

Validate the app locally over HTTP first, then add domain and TLS. For 502 errors check PHP-FPM socket/upstream before DNS; for TLS failures verify DNS and ports 80/443 before application code.

01

Technical scope at a glance

Build a production web stack on Ubuntu 26.04 with Nginx server blocks, PHP-FPM sockets, TLS, UFW, log rotation, health checks, deployment layout and rollback.

80/443Public web ports

For HTTP validation/redirect and HTTPS traffic, verify both firewall policy and listening services.

/run/php/FPM discovery path

Inspect actual installed PHP-FPM sockets rather than guessing a versioned path.

nginx -tRelease gate

Run syntax validation before every Nginx reload.

Health URLApplication signal

A homepage 200 can hide DB/queue failures; a dedicated health endpoint is more meaningful.

On this page

  1. 1. Use a release-oriented deployment layout
  2. 2. Validate the Nginx server block over HTTP first
  3. 3. Discover the actual PHP-FPM socket and worker capacity
  4. 4. Add TLS after DNS and port validation
  5. 5. Design error and latency signals, not just access logs
  6. 6. Make deploy and rollback equally simple
  7. 7. External health and performance checks
  8. Frequently asked questions
02

1. Use a release-oriented deployment layout

Separating code releases, public web root and persistent data makes rollback safer.

PathPurpose
/var/www/app/releases/20260817-2200Immutable release code
/var/www/app/currentActive release symlink
/var/www/app/sharedPersistent uploads/config
Command
sudo install -d -o www-data -g www-data /var/www/app/releases /var/www/app/shared
Command
sudo ln -sfn /var/www/app/releases/20260817-2200 /var/www/app/current
03

2. Validate the Nginx server block over HTTP first

Prove the domain → server → Nginx → application chain over plain HTTP before adding TLS.

Command
sudo apt install nginx -y
Command
sudo nginx -t
Command
sudo systemctl enable --now nginx
Command
curl -I http://127.0.0.1
Command
ss -lntp | grep -E ":80|:443"
04

3. Discover the actual PHP-FPM socket and worker capacity

A wrong socket path is a common Nginx 502 cause; exhausted or crashing FPM workers are another.

Command
ls -lah /run/php/
Command
systemctl list-units --type=service | grep php
Command
grep -R "^pm\.\|^listen" /etc/php/*/fpm/pool.d/www.conf
Command
journalctl -u php*-fpm --since "20 min ago" --no-pager 2>/dev/null | tail -80
05

4. Add TLS after DNS and port validation

Many ACME failures come from wrong A/AAAA records, blocked ports or proxy/origin routing.

Command
dig +short A example.com
Command
dig +short AAAA example.com
Command
sudo ufw allow "Nginx Full"
Command
sudo apt install certbot python3-certbot-nginx -y
Command
sudo certbot --nginx -d example.com -d www.example.com
Command
systemctl list-timers | grep certbot
06

5. Design error and latency signals, not just access logs

Production logs should answer which layer failed. Correlation IDs across Nginx, PHP-FPM and application logs speed diagnosis.

Command
sudo tail -f /var/log/nginx/error.log
Command
sudo logrotate -d /etc/logrotate.d/nginx
Command
journalctl -u nginx -u php*-fpm --since today --no-pager 2>/dev/null | tail -100
07

6. Make deploy and rollback equally simple

A release symlink allows code rollback without recopying files. Database migration rollback must be designed separately.

If the post-deploy health check fails, automatically reverting the symlink is a simple and effective safeguard.
For schema-changing migrations, plan backward compatibility; code rollback alone may not be sufficient.
Command
readlink -f /var/www/app/current
Command
sudo ln -sfn /var/www/app/releases/ONCEKI_SURUM /var/www/app/current
Command
sudo nginx -t && sudo systemctl reload nginx
08

7. External health and performance checks

A curl from the server can bypass DNS, network and CDN layers. Use an external probe.

Command
curl -fsS https://example.com/health
Command
curl -o /dev/null -sS -w "code=%{http_code} connect=%{time_connect} ttfb=%{time_starttransfer} total=%{time_total}
" https://example.com/
Command
openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null | openssl x509 -noout -dates -issuer
EKA SUNUCU · TECHNICAL

Plan the web stack around traffic and deployment, not only CPU/RAM

PHP-FPM workers, cache, database and storage I/O share VPS resources. Choose a simple single-server or staging+production design on Eka Sunucu based on real traffic.

Production principleMeasure → Test → DeployNo fabricated benchmark data.
SRC

Official sources

Primary documentation and technical references used by this guide.

EKA

Related technical guides

Continue with related infrastructure and implementation guides.

FAQ

Frequently asked questions

Ubuntu 26.04 Web Server

Which PHP version should I hard-code for Ubuntu 26.04?

Do not blindly hard-code a version or socket. Discover installed packages with `php -v`, `/run/php/` and systemd because PPAs/panels can change the version.

Is 502 Bad Gateway always a PHP error?

No. The upstream can be down, socket path wrong, permissions invalid or reverse proxy pointing to the wrong target.

Can I use a Cloudflare Origin Certificate instead of Certbot?

It can be used for origin TLS behind Cloudflare proxy, but direct browser-to-origin access and SSL mode must be designed accordingly.

How can I deploy with minimal downtime?

Release directories plus symlinks, prebuilt dependencies and controlled FPM reloads reduce code-switch time; database migrations require separate planning.

Top