Mac 에서 LEMP 설치 설정

2096 단어
Nginx
설치 하 다.
# Search
$ brew search nginx
# Install
$ brew install nginx

배치 하 다.
#   nginx     80
$ vim /usr/local/etc/nginx/nginx.conf
$ ....

# nginx  80    root  
$ sudo chown root:wheel /usr/local/Cellar/nginx/[   ]/bin/nginx
$ sudo chmod u+s /usr/local/Cellar/nginx/[   ]/bin/nginx

#   
$ nginx #    brew services start nginx

#           
$ nginx -t

#       |  |  |   nginx
$ nginx -s reload|reopen|stop|quit

#  launchctl   |  
$ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist

#   nginx  
server {
    listen       80;
    server_name  localhost;

    charset utf-8;

    access_log /usr/local/var/log/nginx/localhost.access.log;
    error_log /usr/local/var/log/nginx/localhost.error.log;

    root /path/to/youSites;
    location / {
        index  index.php index.html index.htm;
        # try_files $uri /$uri index.php?$args;
    }

    error_page  404              /404.html;

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

    #        ,   
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}

Mysql
# Search
$ brew search mysql
# Install
$ brew install mysql
# Exec mysql_secure_installation
$ mysql_secure_installation

#   mysql  
$ mysqld --help --verbose | more
...
Default options are read from the following files in the given order: # mysql         
/etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf
...

#   mysql      
$ ls $(brew --prefix mysql)/support-files/my-*
/usr/local/opt/mysql/support-files/my-default.cnf
#    /usr/local/etc/my.cnf

PHP
# Install php56 or php70 or php71
$ brew install php56
#   php-version      php
$ brew install php-version
# PS: php-version       

기본 개발 이 충분 하고 나머지 최적화 후속 은 계속 되 지 않 습 니 다.

좋은 웹페이지 즐겨찾기