Homebrew Nginx



The article logs my process of using Nginx1.19 + php7.3 + MySQL8 to build the test environment of Magento on my MacBook(macOS Big Sur 11.2.1), I hope it is helpful for you.

Homebrew

The default port has been set in $ (brew -prefix)/etc/nginx/nginx.conf to 8080 so that nginx can run without sudo. Nginx will load all files in $ (brew -prefix)/etc/nginx/servers/. NGINX Homebrew Tap. This tap is designed specifically for a custom build of NGINX with more module options. How do I install these formule (NGINX Modules)? Once the tap is installed, you can install nginx-full with optional additional modules.

Brew Install Nginx

Before starting the installation, you need homebrew installed on the computer.

Nginx Part:

Firstly, install Nginx and start the service

Homebrew Nginx Sites-enabled

Nginx

MySQL Part:

Secondly, install MySQL8, start the service and create the database

Edit my.cnf to run MySQL8 with native password authentication

Save then restart MySQL service

Change MySQL password

Homebrew nginx rtmpNginx

Create new Magento database:

Mysql has been installed successfully and configured properly. Now let us install PHP.

PHP Part:

The default PHP version is PHP8 by brew however Magento2 doesn’t support it so we need to install a downgraded PHP7.3 version and start the service for php-fpm mode which will be occupying port 9000.

After installed, open a new terminal to confirm the latest php7.3 has been installed:

There are some configures you need to set in php.ini

then update following settings:

remember to restart PHP services after updated php.ini

Install composer as the PHP package management tool

Magento Part:

Install elasticsearch and start the service which relied on Magento.

Download Magneto source code to a new folder, I name it as “magento-community” and you can use any name. Company driver download.

You will be asked to provide the name and password for downloading from repo.magento.com, access https://marketplace.magento.com/ , register a new user or login, then, click “My Profile” on your username at the right top of the page.

After downloading successfully, go to the Magento folder,

Install Magento:

Magento has been installed successfully, remember to turn off two-step authentication or you will get an email notification to confirm login.

now let us configure Nginx.

Brew

Configure Nginx to support PHP

Now Magento has been installed successfully on Macbook, you can access it at http://127.0.0.1:8001