Skip to content

Latest commit

 

History

History
143 lines (127 loc) · 2.78 KB

README.md

File metadata and controls

143 lines (127 loc) · 2.78 KB

mempstack

MEMP Stack. MacOSX + Nginx + MySQL + PHP

1. install brew

2. install nginx

brew install nginx

3. Install php include php-fpm

brew install php
// or spesific version
brew install php@7.4

4. Install Mysql

brew install mysql

Configuration after instalation finish on the top

first setup mysql

  • start service mysql
brew services start mysql
  • configuration mysql
mysql_secure_installation
  • follow the instructions until finish
  • start mysql serve
mysql.server start
  • login to mysql from terminal with password your first setup
mysql -u root -p
  • Change the authentication method for root as mysql_native_password to support login in phpmyadmin
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpassword';
  • Reload grant tables
FLUSH PRIVILEGES;
  • finish and exit
exit

Config PHP

  • export path php
sudo nano ~/.zshrc
// or
sudo nano ~/.bash_profile
  • add
export PATH="/usr/local/opt/php@7.3/bin:$PATH"

note: php@7.3 same with installed php in your mac

  • check your php and php-pfm
php -v
php-fpm -v

config nginx

  • create config nginx for your project with ext *.conf, ex: phpmyadmin.conf
server {
    listen 9090;
    index index.php;
    server_name phpmyadmin.local;
    root /root/for/your/project;

    access_log  /usr/local/etc/nginx/logs/phpmyadmin.access.log;
    error_log /usr/local/etc/nginx/logs/phpmyadmin.error.log;

    client_max_body_size 100m;
    client_body_buffer_size 512k;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;

        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include /usr/local/etc/nginx/fastcgi.conf;
    }
}
  • put to directory /usr/local/etc/nginx/servers note : show hidden file with keyboard shortcuts cmd + shift + .
  • make dir for log nginx
mkdir /usr/local/etc/nginx/logs
  • cek your config health with
nginx -t

basic opration nginx

  • start
sudo nginx
  • stop
sudo nginx -s stop
  • reload
sudo nginx -s reload

basic opration mysql

  • start
mysql.server start
  • stop
mysql.server stop

note: after change config file .conf nginx must be check config with nginx-t and reload nginx with sudo nginx -s reload

Finish

cek your with localhost:9090 (config port on file *.conf)

note : first on your laptop must be run service nginx (if not active), php-fpm (if not active) and mysql (if nor active)