Skip to content

Instantly share code, notes, and snippets.

@vitalyrotari
Forked from hjr3/nginx.conf
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vitalyrotari/6c4a19922453ec622bc3 to your computer and use it in GitHub Desktop.
Save vitalyrotari/6c4a19922453ec622bc3 to your computer and use it in GitHub Desktop.
upstream phpfpm {
server 127.0.0.1:9000;
}
server {
listen 80;
server_name _;
root /var/www/html;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ "\.php$" {
# requires http://wiki.nginx.org/HttpHeadersMoreModule to handle response codes that add_header ignores
more_set_headers "Access-Control-Allow-Origin: $http_origin";
more_set_headers "Access-Control-Allow-Credentials: true";
more_set_headers "Access-Control-Allow-Methods: GET, POST, DELETE, PUT, OPTIONS";
more_set_headers "Access-Control-Allow-Headers: Keep-Alive,User-Agent,If-Modified-Since,Cache-Control,Content-Type,Authorization";
more_set_headers "Access-Control-Max-Age: 1728000";
include fastcgi_params;
fastcgi_pass phpfpm;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment