Skip to content

Instantly share code, notes, and snippets.

@lahmacun
Created September 8, 2018 15:06
Show Gist options
  • Save lahmacun/ab8c62f282dae23825d85647153212c6 to your computer and use it in GitHub Desktop.
Save lahmacun/ab8c62f282dae23825d85647153212c6 to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name dummy_site.local;
# MAMP DOCUMENT_ROOT !! Don't remove this line !!
root "/Applications/MAMP/htdocs/dummy_site.local/public";
access_log /Applications/MAMP/logs/nginx_access.log;
error_log /Applications/MAMP/logs/nginx_error.log;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ ^/index\.php(/|$) {
fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
}
location ~ \.php$ {
return 404;
}
}
@Romain
Copy link

Romain commented Aug 5, 2020

Thanks @lahmacun.
With Mamp Pro 5.4 and Symfony 5.1, I had to change

  • fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock; by fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI_php7.2.20.sock;
  • include fastcgi_params by include /Applications/MAMP/conf/nginx/fastcgi_params;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment