docs: clearer README, more user-friendly

This commit is contained in:
2025-11-27 16:32:49 +01:00
parent 37c915075b
commit 5d590e3be6

111
README.md
View File

@@ -1,54 +1,123 @@
# Nginx PHP-FPM for Ubuntu 24.04 Server
# Nginx + PHP-FPM on Ubuntu 24.04
[![OS](https://img.shields.io/badge/ubuntu-24.04-E95420)](#)
[![Shell](https://img.shields.io/badge/shell-bash-121011)](#)
[![WebServer](https://img.shields.io/badge/server-nginx-009639)](#)
[![PHP](https://img.shields.io/badge/php-fpm-777BB4)](#)
[![License](https://img.shields.io/badge/License-MIT-green)](./LICENSE)
Automated Bash installer script for deploying Nginx with PHP-FPM on Ubuntu 24.04 Server.
Automated Bash installer for **Nginx + PHP-FPM on Ubuntu 24.04 Server**.
Tuned for production, battle-ready, and built for people who like uptime more than debugging.
This is a **production-focused installer**, not a demo.
This isnt a “hello world” demo environment.
This script builds a **real web server** — hardened, structured, and ready to host more than one weekend project.
---
### Preparing
Update your package index before running the installer:
## Why this installer exists
Because the default Nginx package leaves you with:
❌ default site you immediately disable
❌ configs scattered like confetti
❌ wrong IPs when behind Cloudflare
❌ no snippet structure
❌ caching off, security minimal
❌ weird defaults nobody asked for
This script fixes that:
✔ Creates `/etc/nginx/nginx-snippets/`
✔ Cloudflare Real-IP awareness
✔ Default virtualhost returns **444** instead of smiling politely
✔ Optional security snippets
✔ PHP-FPM pre-wired and ready
You deploy once — not fight it for half a day.
---
## 1. Prepare your system
```
sudo apt update -y
```
### Download the Script
Clone the repository from your Git server:
---
## 2. Download and enter the installer
```
git clone https://git.x-files.dk/webserver/nginx-ubuntu.git
```
```
cd nginx-ubuntu
```
### Usage
Run the script using:
---
## 3. Run the installer
```
sudo ./nginxinstall
```
---
After this runs, you have:
#### Nginx Configuration Includes
- A directory called **nginx-snippets** in `/etc/nginx`, containing reusable snippets for clean and readable setups.
- Cloudflare Real IP configuration to ensure proxied IPs are correctly displayed.
- The default website answering on the server IP address is disabled and returns **444** (drops TCP connection).
- Bad bots blocking file, CSP, and SSL configurations (can be customized).
- Custom error pages located in `/etc/nginx-snippets/errorpages` (editable as needed).
| Feature | Status |
|--------|--------|
| Nginx installed & enabled | ✓ |
| PHP-FPM configured | ✓ |
| Snippet structure created | ✓ |
| Default website disabled | ✓ (returns HTTP 444) |
| Cloudflare Real-IP support | ✓ |
| Bad-bot blocking available | ✓ |
| Custom error pages | ✓ editable |
---
### Notes
This setup includes enhanced caching, which is left commented out in the nginx.conf file after installation. You can enable and adjust it according to your needs.
## Included Nginx Features
### 📁 `/etc/nginx/nginx-snippets/`
Reusable drop-in configs:
| Snippet | Purpose |
|--------|---------|
| cloudflare.conf | Fixes real visitor IPs |
| block-bots.conf | Drops garbage traffic |
| csp.conf | Security headers |
| ssl.conf | TLS configuration |
| errorpages/ | Custom 40x/50x pages |
---
### Default IP response
Server IP access = **444 Drop.**
Because your server is not public property.
---
### Caching
Performance tuning examples included, **commented until activated intentionally**.
---
## What happens after install?
Example vhost:
```
server {
listen 443 ssl http2;
server_name yourdomain.com;
include nginx-snippets/cloudflare.conf;
include nginx-snippets/block-bots.conf;
root /var/www/yourproject;
index index.php index.html;
}
```
---