Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 1.45 KB | None | 0 0
  1. server {
  2.     server_name domain.tld www.domain.tld;
  3.     root /var/www/project/public;
  4.  
  5.     location / {
  6.         # try to serve file directly, fallback to index.php
  7.         try_files $uri /index.php$is_args$args;
  8.     }
  9.  
  10.     location ~ ^/index\.php(/|$) {
  11.         fastcgi_pass unix:/var/run/php7.1-fpm.sock;
  12.         fastcgi_split_path_info ^(.+\.php)(/.*)$;
  13.         include fastcgi_params;
  14.         # When you are using symlinks to link the document root to the
  15.         # current version of your application, you should pass the real
  16.         # application path instead of the path to the symlink to PHP
  17.         # FPM.
  18.         # Otherwise, PHP's OPcache may not properly detect changes to
  19.         # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
  20.         # for more information).
  21.         fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
  22.         fastcgi_param DOCUMENT_ROOT $realpath_root;
  23.         # Prevents URIs that include the front controller. This will 404:
  24.         # http://domain.tld/index.php/some-path
  25.         # Remove the internal directive to allow URIs like this
  26.         internal;
  27.     }
  28.  
  29.     # return 404 for all other php files not matching the front controller
  30.     # this prevents access to other php files you don't want to be accessible.
  31.     location ~ \.php$ {
  32.         return 404;
  33.     }
  34.  
  35.     error_log /var/log/nginx/project_error.log;
  36.     access_log /var/log/nginx/project_access.log;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement