Advertisement
Guest User

Untitled

a guest
Mar 5th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ### PART OF CONFIG LOCATED IN /etc/nginx/sites-enabled
  2.  
  3. location ~ \.php$ {
  4.     fastcgi_index index.php;
  5.     fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
  6.     include fastcgi_params;
  7.  
  8.     fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
  9.     fastcgi_param DOCUMENT_ROOT $realpath_root;
  10.     internal;
  11. }
  12.  
  13. ### REPLACED WITH THIS
  14.  
  15. location / {
  16.     try_files $uri $uri/ /index.php$is_args$args;
  17.     autoindex on;
  18. }
  19.  
  20. location ~ \.php$ {
  21.    
  22.     # regex to split $uri to $fastcgi_script_name and $fastcgi_path
  23.     fastcgi_split_path_info ^(.+\.php)(/.+)$;
  24.  
  25.     # Check that the PHP script exists before passing it
  26.     try_files $fastcgi_script_name =404;
  27.  
  28.     # Bypass the fact that try_files resets $fastcgi_path_info
  29.     # see: http://trac.nginx.org/nginx/ticket/321
  30.     set $path_info $fastcgi_path_info;
  31.     fastcgi_param PATH_INFO $path_info;
  32.     fastcgi_read_timeout 3600;
  33.  
  34.     fastcgi_index index.php;
  35.    
  36.     fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
  37.     fastcgi_param  QUERY_STRING       $query_string;
  38.     fastcgi_param  REQUEST_METHOD     $request_method;
  39.     fastcgi_param  CONTENT_TYPE       $content_type;
  40.     fastcgi_param  CONTENT_LENGTH     $content_length;
  41.  
  42.     fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
  43.     fastcgi_param  REQUEST_URI        $request_uri;
  44.     fastcgi_param  DOCUMENT_URI       $document_uri;
  45.     fastcgi_param  DOCUMENT_ROOT      $document_root;
  46.     fastcgi_param  SERVER_PROTOCOL    $server_protocol;
  47.     fastcgi_param  REQUEST_SCHEME     $scheme;
  48.     fastcgi_param  HTTPS              $https if_not_empty;
  49.  
  50.     fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
  51.     fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
  52.  
  53.     fastcgi_param  REMOTE_ADDR        $remote_addr;
  54.     fastcgi_param  REMOTE_PORT        $remote_port;
  55.     fastcgi_param  SERVER_ADDR        $server_addr;
  56.     fastcgi_param  SERVER_PORT        $server_port;
  57.     fastcgi_param  SERVER_NAME        $server_name;
  58.  
  59.     # PHP only, required if PHP was built with --enable-force-cgi-redirect
  60.     fastcgi_param  REDIRECT_STATUS    200;
  61.  
  62.     #fastcgi_pass unix:/run/php/php7.0-fpm.sock;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement