1+ # Nginx configuration
2+
3+ server {
4+ listen 80 default_server;
5+ listen [::]:80 default_server;
6+ server_name localhost;
7+
8+ root /var/www/html/public;
9+
10+ location / {
11+ # try to serve file directly, fallback to index.php
12+ try_files $uri /index.php$is_args$args;
13+ }
14+
15+ location ~ ^/index\.php(/|$) {
16+ fastcgi_pass php:9000;
17+ fastcgi_split_path_info ^(.+\.php)(/.*)$;
18+ include fastcgi_params;
19+
20+ # optionally set the value of the environment variables used in the application
21+ # fastcgi_param APP_ENV prod;
22+ # fastcgi_param APP_SECRET <app-secret-id>;
23+ # fastcgi_param DATABASE_URL "mysql://db_user:db_pass@host:3306/db_name";
24+
25+ # When you are using symlinks to link the document root to the
26+ # current version of your application, you should pass the real
27+ # application path instead of the path to the symlink to PHP
28+ # FPM.
29+ # Otherwise, PHP's OPcache may not properly detect changes to
30+ # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
31+ # for more information).
32+ fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
33+ fastcgi_param DOCUMENT_ROOT $realpath_root;
34+ # Prevents URIs that include the front controller. This will 404:
35+ # http://domain.tld/index.php/some-path
36+ # Remove the internal directive to allow URIs like this
37+ internal;
38+ }
39+
40+ # return 404 for all other php files not matching the front controller
41+ # this prevents access to other php files you don't want to be accessible.
42+ location ~ \.php$ {
43+ return 404;
44+ }
45+
46+ error_log /var/log/nginx/project_error.log;
47+ access_log /var/log/nginx/project_access.log;
48+ }
0 commit comments