Mac下LEMP安裝配置

Nginx

安裝
# Search
$ brew search nginx
# Install
$ brew install nginx
配置
# 修改nginx默認端口為80
$ vim /usr/local/etc/nginx/nginx.conf
$ ....

# nginx監(jiān)聽80端口需要root權(quán)限
$ 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使用在其他版本

基本開發(fā)足夠,其余優(yōu)化后續(xù)
未完待續(xù)..

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,525評論 19 139
  • Android 自定義View的各種姿勢1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 178,828評論 25 709
  • 1.MySQL是一個關系型數(shù)據(jù)庫管理系統(tǒng),由瑞典MySQL AB 公司開發(fā),目前屬于 Oracle 旗下產(chǎn)品。My...
    黃花菜已涼閱讀 4,658評論 3 60
  • 在人的一生中總會有許多迷茫的時刻,各種誘惑蜂擁而至想要讓你墮落,于是你在欲望與理性之中苦苦爭扎,不知所措。 突然,...
    葉落風狂舞閱讀 226評論 0 0
  • 聽 那滴答滴答的雨聲 聲聲入耳,撩動心弦 抬頭,望啊 雨水濺起,那屋檐,白蒙蒙一片 風是最不爭氣的想念 雨是難以抗...
    慕卿苑閱讀 205評論 0 0

友情鏈接更多精彩內(nèi)容