Fix #15621 - Support CloudFront-Forwarded-Proto header
[phpmyadmin.git] / test / nginx.conf
blobf37fd24b1dc83d19aa99033f1a9a4d6e9e8aab0f
1 worker_processes 4;
3 daemon on;
5 pid %DIR%/nginx.pid;
7 error_log %ROOT%/nginx-error.log;
9 events {
10     worker_connections 1024;
13 http {
14     types {
15         text/html                             html htm shtml;
16         text/css                              css;
17         text/xml                              xml;
18         image/gif                             gif;
19         image/jpeg                            jpeg jpg;
20         application/javascript                js;
21         application/atom+xml                  atom;
22         application/rss+xml                   rss;
23     }
25     default_type application/octet-stream;
27     sendfile on;
28     tcp_nopush on;
29     tcp_nodelay on;
31     client_body_timeout 12;
32     client_header_timeout 12;
33     keepalive_timeout 15;
34     send_timeout 10;
35     server_tokens off;
37     client_body_buffer_size 512K;
38     client_body_temp_path %DIR%/client_body_temp;
39     client_header_buffer_size 16k;
40     client_max_body_size 512M;
41     large_client_header_buffers 4 8k;
43     gzip on;
44     gzip_comp_level 2;
45     gzip_min_length 1000;
46     gzip_proxied expired no-cache no-store private auth;
47     gzip_types text/plain application/x-javascript text/xml text/css application/xml;
49     access_log off;
51     server {
52         listen 8000 default_server;
53         server_name _;
55         root %ROOT%;
57         index index.php index.html index.htm;
59         charset utf-8;
61         if ($request_method !~ ^(GET|HEAD|POST)$ ) {
62            return 405;
63         }
65         location / {
66             try_files $uri $uri/ =404;
67         }
69         location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
70             expires 365d;
71         }
73         location ~ \.php$ {
74             fastcgi_intercept_errors on;
75             fastcgi_pass unix:%DIR%/php-fpm.sock;
77             # regex to split $uri to $fastcgi_script_name and $fastcgi_path
78             fastcgi_split_path_info ^(.+\.php)(/.+)$;
80             # Check that the PHP script exists before passing it
81             try_files $fastcgi_script_name =404;
83             # Bypass the fact that try_files resets $fastcgi_path_info
84             # see: https://trac.nginx.org/nginx/ticket/321
85             set $path_info $fastcgi_path_info;
86             fastcgi_param PATH_INFO $path_info;
88             fastcgi_read_timeout 1200;
90             fastcgi_index index.php;
92             fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
93             fastcgi_param  QUERY_STRING       $query_string;
94             fastcgi_param  REQUEST_METHOD     $request_method;
95             fastcgi_param  CONTENT_TYPE       $content_type;
96             fastcgi_param  CONTENT_LENGTH     $content_length;
98             fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
99             fastcgi_param  REQUEST_URI        $request_uri;
100             fastcgi_param  DOCUMENT_URI       $document_uri;
101             fastcgi_param  DOCUMENT_ROOT      $document_root;
102             fastcgi_param  SERVER_PROTOCOL    $server_protocol;
103             fastcgi_param  REQUEST_SCHEME     $scheme;
104             fastcgi_param  HTTPS              $https if_not_empty;
106             fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
107             fastcgi_param  SERVER_SOFTWARE    nginx;
109             fastcgi_param  REMOTE_ADDR        $remote_addr;
110             fastcgi_param  REMOTE_PORT        $remote_port;
111             fastcgi_param  SERVER_ADDR        $server_addr;
112             fastcgi_param  SERVER_PORT        $server_port;
113             fastcgi_param  SERVER_NAME        $server_name;
115             # PHP only, required if PHP was built with --enable-force-cgi-redirect
116             fastcgi_param  REDIRECT_STATUS    200;
117         }
119         location ~ /\. {
120             deny  all;
121         }
123         location ~ /(libraries|templates) {
124             deny all;
125         }
127     }