Nginx PHP-FPM for Ubuntu 24.04 Server
Automated Bash installer script for deploying Nginx with PHP-FPM on Ubuntu 24.04 Server.
This is a production-focused installer, not a demo.
Preparing
Update your package index before running the installer:
sudo apt update -y
Download the Script
Clone the repository from your Git server:
git clone https://git.x-files.dk/web-server/nginx-ubuntu.git
cd nginx-ubuntu
Usage
Run the script to install and configure Nginx and PHP-FPM automatically:
sudo ./nginxinstall
Nginx Configuration Includes
- A directory called nginxsnippets 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/nginxsnippets/errorpages
(editable as needed).
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.
More Information
More guides and documentation can be found on wiki.x-files.dk
License
Licensed under the MIT License.
Description
Languages
Shell
100%