Skip to content

Instantly share code, notes, and snippets.

@apiworks
Created November 6, 2017 09:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save apiworks/892366b1db833efa0c39cdcf682012d6 to your computer and use it in GitHub Desktop.
Save apiworks/892366b1db833efa0c39cdcf682012d6 to your computer and use it in GitHub Desktop.
Magento 1 NGINX config for MAMP Pro
server {
listen 80;
server_name sample.loc;
set $MAGE_ROOT /Users/darkogoles/Sites/sample.loc;
access_log /usr/local/etc/nginx/logs/sample_access.log;
error_log /usr/local/etc/nginx/logs/sample_error.log;
root $MAGE_ROOT;
index index.php;
autoindex off;
charset UTF-8;
error_page 404 403 = /errors/404.php;
#add_header "X-UA-Compatible" "IE=Edge";
## These locations would be hidden by .htaccess normally
location ^~ /app/ { deny all; }
location ^~ /includes/ { deny all; }
location ^~ /lib/ { deny all; }
location ^~ /media/downloadable/ { deny all; }
location ^~ /pkginfo/ { deny all; }
location ^~ /report/config.xml { deny all; }
location ^~ /var/ { deny all; }
location /var/export/ { deny all; }
# deny htaccess files
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location ~* \.(jpg|jpeg|png|gif|ico)$ {
expires 365d;
log_not_found off;
access_log off;
}
location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}
## rewrite anything else to index.php
location / {
index index.html index.php;
try_files $uri $uri/ /index.php?$query_string;
expires 30d;
rewrite /api/rest /api.php?type=rest;
}
# pass the PHP scripts to FPM socket
location ~ \.php$ {
fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI_php5.6.31.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include /Applications/MAMP/conf/nginx/fastcgi_params;
}
}
@AndrianD
Copy link

Using Mamp Pro I've been searching for hours where the fastcgi_params is located, now I found it. Thank you very much!

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