Skip to content

Instantly share code, notes, and snippets.

@robertwe
Created November 10, 2017 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save robertwe/6b66559729a0e7450e7dd2d1fcd61025 to your computer and use it in GitHub Desktop.
Save robertwe/6b66559729a0e7450e7dd2d1fcd61025 to your computer and use it in GitHub Desktop.
server {
server_name myhostname.local;
root /var/www/symfony/web;
location / {
try_files $uri @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /app_dev.php/$1 last;
}
location ~ ^/(app|app_dev|config)\.php(/|$) {
fastcgi_pass php-upstream;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
# Statics
location ~ (bundles|css|fonts|images|js)(/.*)$ {
#Im desperated
if (!-f $uri){
return 404;
}
# end of the act of desperation
access_log off;
expires 30d;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET';
try_files $uri =404;
}
error_log /var/log/nginx/symfony_error.log debug;
access_log /var/log/nginx/symfony_access.log debug;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment