Skip to content

Instantly share code, notes, and snippets.

@roes888
Created April 28, 2016 06:19
Show Gist options
  • Select an option

  • Save roes888/e4c0f52aabed91139cd7c3f16728f1dc to your computer and use it in GitHub Desktop.

Select an option

Save roes888/e4c0f52aabed91139cd7c3f16728f1dc to your computer and use it in GitHub Desktop.
Nginx virtual host + PHP 7
server {
listen 80;
server_name some.domain;
root /path/to/file;
index index.php index.htm index.html;
location ~ .php$ {
#try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param ENVIRONMENT production;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
include fastcgi_params;
fastcgi_read_timeout 300;
# add_header 'Access-Control-Allow-Origin' '*';
# add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept';
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE, HEAD, PATCH';
# more_set_headers 'Access-Control-Allow-Origin: http://localhost';
# more_set_headers 'Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE, HEAD, PATCH';
# more_set_headers 'Access-Control-Allow-Credentials: true';
# more_set_headers 'Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment