9

Does anybody suceeded on setup Magento2 and MAMP's nginx? I'm using MAMP PRO 4.1.1 and didn't realize how MAMP works with the rewrites and rules we config for each site, or if there's a way to debug and see the final used nginx config.

enter image description here

I would appreciate if anybody shares the config for Magento2 on this screen.

Thank you.

Community
  • 1
  • 1
Ricardo Martins
  • 5,702
  • 3
  • 40
  • 59
  • http://devdocs.magento.com/guides/v2.0/install-gde/prereq/nginx.html - here it states that all you need to do is proper configuration of fast cgi / server. I don't MAMP, so can't help more. However, from my perspective all you need to do i proper configuration of server in nginx meaning. – Michał Zaborowski Oct 01 '17 at 18:44
  • Thank you Michal. The link is broken, but I've tried with the official documentation, and MAMP doesn't work as expected with them. Thank you for trying anyway. – Ricardo Martins Oct 01 '17 at 22:13
  • Well, at my side that link works just fine. Anyway - maybe switching to old Apache would fix your setup. At least docs are better there. I know that it is not what you are asking for - just looking for solution... :) – Michał Zaborowski Oct 02 '17 at 09:07
  • Hi Michaal. The link is working now, but no success with the information. I'm already using MAMP with Apache, but want to use with Nginx. Thank you anyway. – Ricardo Martins Oct 03 '17 at 05:34

3 Answers3

2

I just ran into this issue and for me it was that my hosts had both "Apache" and "Nginx" selected. What was weird is that I was unable to change it, so I had to create a new host with just NGINX selected and it worked.

You may also need to setup NGINX "try_files" under the NGINX tab like so: $uri $uri/ /index.php?$args

enter image description here

enter image description here

Also This link provided some more helpful info.

Cskip
  • 86
  • 1
  • 4
2

It's been 2 years since I posted the question, and some of the answers here helped to figure out how to configure Nginx + Magento 2 + Mamp Pro.

Here is my final configuration that worked with Magento 2.3.0 with SSL on local.

hosts config

attention to the general config

Under the Nginx tab, I've added:

  • Directory index: index.php
  • try files: $uri $uri/ /index.php?$args
  • Custom: empty
  • Additional parameters for directive: https://pastebin.com/pQ5KKCQ7
    • Note on line 27 I've added the current magento folder

Under nginx config:

MAMP Nginx config

Under Ports:

Ports

Final Result:

Luma home page with nginx and mamp

Final thoughts

I don't know which of these configurations are really necessary, and which one are (maybe) incorrect. However, my M2 is now working very well on MAMP PRO 5.3.

Next step is to make mamp support HTTP/2 and make Magento 2 even faster on local.

A huge thank you for those who replied earlier. Your answers helped me to solve some parts of the puzzle. I'm glad to be sharing the whole solution with you now.

If it doesn't work for you, keel an eye on MAMP Nginx log. It may bring some useful information about what's wrong.

Ricardo Martins
  • 5,702
  • 3
  • 40
  • 59
  • Thanks for the detailed answer. For some reason, the php files are just downloading instead of running, and idea why? – omerts Apr 26 '20 at 21:39
1

You have to turn off "Use Nginx as a Reverse Proxy for Apache", otherwise, you need to turn on your Apache to work with nginx.

Screenshot

chiboshi2
  • 11
  • 3