Skip to content

Instantly share code, notes, and snippets.

@rakeshjames
Last active February 12, 2016 10:56
Show Gist options
  • Save rakeshjames/75e557e60dbbaf9c38ce to your computer and use it in GitHub Desktop.
Save rakeshjames/75e557e60dbbaf9c38ce to your computer and use it in GitHub Desktop.
server {
listen 80 default_server;
root /srv/www/drupal8;
index index.php index.html index.htm;
server_name YOUR_SERVER_NAME.com;
location / {
try_files $uri @rewrite;
}
location @rewrite {
rewrite ^ /index.php;
}
error_page 404 /404.html;
error_page 403 /403.html;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
try_files $uri $uri/ /index.php?q=$uri&$args;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
add_header Access-Control-Allow-Origin *;
proxy_set_header Access-Control-Allow-Origin $http_origin;
}
location ~ ^/sites/.*/files/styles/ {
try_files $uri @rewrite;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml|js|htm|html)$ {
#access_log off;
#log_not_found off;
expires 360d;
#try_files $uri @rewrite;
}
location ~* \.(ttf|otf|eot)$ {
add_header Access-Control-Allow-Origin "*";
}
# RSS Feed.
location = /rss.xml {
rewrite ^ /index.php?q=rss.xml;
}
# Sitemap Feed.
location = /sitemap.xml {
try_files $uri /index.php?q=sitemap.xml;
}
location ~ /\. {
access_log off;
log_not_found off;
deny all;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment