Skip to Content
Installation GuideStep 8: Nginx

Step 8: Configure Nginx

Create an Nginx server block:

nano /etc/nginx/sites-available/ai-education-studio

Add the following configuration:

server { listen 80; server_name yourdomain.com www.yourdomain.com; root /var/www/ai-education-studio/public; index index.php index.html; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\.(?!well-known).* { deny all; } location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ { expires 30d; add_header Cache-Control "public, immutable"; } }

Enable the site:

ln -s /etc/nginx/sites-available/ai-education-studio /etc/nginx/sites-enabled/ nginx -t systemctl reload nginx

Info: The try_files directive is critical. It ensures that Laravel handles all routing (including React Router paths) instead of Nginx returning 404s.

Last updated on