-
Notifications
You must be signed in to change notification settings - Fork 0
ch01_configure_nginx
Daniel Samson edited this page Sep 30, 2025
·
3 revisions
To configure nginx, you need to pass the url query param into your index.php:
# /etc/nginx/nginx.conf
user nginx;
worker_processes auto;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
# Gzip compression (optional)
gzip on;
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
server {
listen 80;
server_name example.com www.example.com;
root /var/www/html/public;
index index.html;
location / {
# try_files $uri $uri/ =404;
if (!-e $request_filename){
rewrite ^/(.*) /index.php?url=$1 break;
}
}
# Error pages
error_page 404 /404.html;
location = /404.html {
internal;
}
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
}
}