Nginx
Learn how to configure an nginx server.
Configuring Nginx
To configure the nginx web server, you can use the following example to configure your nginx.conf:
location / {
root /home/foo/bar/my-app;
# Redirect page errors to route system
error_page 403 500 /index.php;
try_files /public$uri /index.php?$query_string;
location = / {
try_files $uri /index.php?$query_string;
}
location ~ /\. {
try_files /index.php$uri /index.php?$query_string;
}
location ~ \.php$ {
# Replace by your FPM or FastCGI
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
set $inphinit_prefix "";
if ($uri != "/index.php") {
set $inphinit_prefix "/public";
}
fastcgi_param SCRIPT_FILENAME $realpath_root$inphinit_prefix$fastcgi_script_name;
}
}