安裝xcode命令行工具的命令
xcode-select --install
安裝homebrew:php
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
舊版本homebrew升級:html
brew update
brew install nginxmysql
➜ ~ brew install nginx Updating Homebrew... ==> Installing dependencies for nginx: pcre, openssl@1.1 ==> Installing nginx dependency: pcre ==> Downloading https://homebrew.bintray.com/bottles/pcre-8.39.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring pcre-8.39.sierra.bottle.tar.gz 🍺 /usr/local/Cellar/pcre/8.39: 203 files, 5.4M ==> Installing nginx dependency: openssl@1.1 ==> Downloading https://homebrew.bintray.com/bottles/openssl@1.1-1.1.0c.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring openssl@1.1-1.1.0c.sierra.bottle.tar.gz ==> Using the sandbox ==> Caveats A CA file has been bootstrapped using certificates from the system keychain. To add additional certificates, place .pem files in /usr/local/etc/openssl@1.1/certs and run /usr/local/opt/openssl@1.1/bin/c_rehash This formula is keg-only, which means it was not symlinked into /usr/local. Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries Generally there are no consequences of this for you. If you build your own software and it requires this formula, you'll need to add to your build variables: LDFLAGS: -L/usr/local/opt/openssl@1.1/lib CPPFLAGS: -I/usr/local/opt/openssl@1.1/include ==> Summary 🍺 /usr/local/Cellar/openssl@1.1/1.1.0c: 6,225 files, 15.3M ==> Installing nginx ==> Downloading https://homebrew.bintray.com/bottles/nginx-1.10.2_1.sierra.bottle.1.tar.gz ######################################################################## 100.0% ==> Pouring nginx-1.10.2_1.sierra.bottle.1.tar.gz ==> Caveats Docroot is: /usr/local/var/www The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that nginx can run without sudo. nginx will load all files in /usr/local/etc/nginx/servers/. To have launchd start nginx now and restart at login: brew services start nginx Or, if you don't want/need a background service you can just run: nginx ==> Summary 🍺 /usr/local/Cellar/nginx/1.10.2_1: 8 files, 979.8K
配置非管理員開機nginx自動啓動的權限和分組:nginx
sudo chown root:wheel /usr/local/Cellar/nginx/1.10.2_1/sbin/nginx sudo chmod u+s /usr/local/Cellar/nginx/1.10.2_1/sbin/nginx
nginx相關命令:git
# 查看nginx版本
➜ ~ nginx -v nginx version: nginx/1.10.2
# 啓動 nginx服務
sudo nginx
#測試配置是否有語法錯誤
github
➜ ~ nginx -t nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
# 從新加載配置|重啓|中止|退出
web
nginx nginx -s reload|reopen|stop|quit
瀏覽器中查看效果redis
nginx啓動後,在瀏覽器中輸入http://localhost:8080/,回車便可看到運行結果 顯示的是/usr/local/Cellar/nginx/1.10.2_1/html/index.html文件的內容。
開機自啓動nginx服務設置:sql
mkdir -p ~/Library/LaunchAgents ➜ ~ cp /usr/local/Cellar/nginx/1.10.2_1/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/ ➜ ~ cp /usr/local/Cellar/nginx/1.10.2_1/homebrew.mxcl.nginx.plist /Users/cony/Library/LaunchAgents/ ➜ ~ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist ➜ ~ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist #取消開機啓動
brew install mysqlmongodb
➜ ~ brew install mysql Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> Updated Formulae macvim pgbadger proxychains-ng ==> Installing dependencies for mysql: openssl ==> Installing mysql dependency: openssl ==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2j.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring openssl-1.0.2j.sierra.bottle.tar.gz ==> Using the sandbox ==> Caveats A CA file has been bootstrapped using certificates from the SystemRoots keychain. To add additional certificates (e.g. the certificates added in the System keychain), place .pem files in /usr/local/etc/openssl/certs and run /usr/local/opt/openssl/bin/c_rehash This formula is keg-only, which means it was not symlinked into /usr/local. Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries Generally there are no consequences of this for you. If you build your own software and it requires this formula, you'll need to add to your build variables: LDFLAGS: -L/usr/local/opt/openssl/lib CPPFLAGS: -I/usr/local/opt/openssl/include ==> Summary 🍺 /usr/local/Cellar/openssl/1.0.2j: 1,695 files, 12M ==> Installing mysql ==> Downloading https://homebrew.bintray.com/bottles/mysql-5.7.17.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring mysql-5.7.17.sierra.bottle.tar.gz ==> /usr/local/Cellar/mysql/5.7.17/bin/mysqld --initialize-insecure --user=cony --basedir=/usr/local/Cellar/mysql/5.7.17 --datadir=/usr/local/var/mysql --tmpdir=/tmp ==> Caveats We've installed your MySQL database without a root password. To secure it run: mysql_secure_installation To connect run: mysql -uroot To have launchd start mysql now and restart at login: brew services start mysql Or, if you don't want/need a background service you can just run: mysql.server start ==> Summary 🍺 /usr/local/Cellar/mysql/5.7.17: 14,226 files, 444.4M
加入開機啓動
➜ ~ cp /usr/local/opt/mysql/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/ ➜ ~ cp /usr/local/opt/mysql/homebrew.mxcl.mysql.plist /Users/cony/Library/LaunchAgents/ ➜ ~ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist ➜ ~ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
mysql命令:
mysql.server start # mysql 開啓
mysql.server stop # mysql 關閉
初始化mysql數據庫:
➜ ~ cd /usr/local/Cellar/mysql/5.7.17/bin ➜ ~ ./mysql_install_db
設置root帳戶和密碼:
./mysql_secure_installation 一直跟着提示走就行
➜
~ brew install redis ==> Downloading https://homebrew.bintray.com/bottles/redis-3.2.6.sierra.bottle.tar.g ######################################################################## 100.0% ==> Pouring redis-3.2.6.sierra.bottle.tar.gz ==> Caveats To have launchd start redis now and restart at login: brew services start redis Or, if you don't want/need a background service you can just run: redis-server /usr/local/etc/redis.conf ==> Summary 🍺 /usr/local/Cellar/redis/3.2.6: 11 files, 1.7M
redis默認配置文件不容許以Deamon方式運行,所以須要先修改配置文件
~ vi /usr/local/etc/redis.conf➜
將daemonize修改成yes,而後載入配置文件便可實現後臺進程啓動
redis-server /usr/local/etc/redis.conf
加入開機啓動
➜ ~ cp /usr/local/Cellar/redis/3.2.6/homebrew.mxcl.redis.plist /Users/cony/Library/LaunchAgents/
測試redis server是否啓動
➜ ~ redis-cli ping
PONG
brew install php70 --without-apache --with-fpm
➜ ~ brew install php70 --without-apache --with-fpm Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). No changes to formulae. ==> Installing php70 from homebrew/php ==> Installing dependencies for homebrew/php/php70: gettext, icu4c, jpeg, libxml2, unixodbc, readline ==> Installing homebrew/php/php70 dependency: gettext ==> Downloading https://homebrew.bintray.com/bottles/gettext-0.19.8.1.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring gettext-0.19.8.1.sierra.bottle.tar.gz ==> Caveats This formula is keg-only, which means it was not symlinked into /usr/local. macOS provides the BSD gettext library and some software gets confused if both are in the library path. Generally there are no consequences of this for you. If you build your own software and it requires this formula, you'll need to add to your build variables: LDFLAGS: -L/usr/local/opt/gettext/lib CPPFLAGS: -I/usr/local/opt/gettext/include ==> Summary 🍺 /usr/local/Cellar/gettext/0.19.8.1: 1,934 files, 16.9M ==> Installing homebrew/php/php70 dependency: icu4c ==> Downloading https://homebrew.bintray.com/bottles/icu4c-58.2.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring icu4c-58.2.sierra.bottle.tar.gz ==> Caveats This formula is keg-only, which means it was not symlinked into /usr/local. macOS provides libicucore.dylib (but nothing else). Generally there are no consequences of this for you. If you build your own software and it requires this formula, you'll need to add to your build variables: LDFLAGS: -L/usr/local/opt/icu4c/lib CPPFLAGS: -I/usr/local/opt/icu4c/include ==> Summary 🍺 /usr/local/Cellar/icu4c/58.2: 242 files, 65M ==> Installing homebrew/php/php70 dependency: jpeg ==> Downloading https://homebrew.bintray.com/bottles/jpeg-8d.sierra.bottle.2.tar.gz ######################################################################## 100.0% ==> Pouring jpeg-8d.sierra.bottle.2.tar.gz 🍺 /usr/local/Cellar/jpeg/8d: 19 files, 708.3K ==> Installing homebrew/php/php70 dependency: libxml2 ==> Downloading https://homebrew.bintray.com/bottles/libxml2-2.9.4_2.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring libxml2-2.9.4_2.sierra.bottle.tar.gz ==> Caveats This formula is keg-only, which means it was not symlinked into /usr/local. macOS already provides this software and installing another version in parallel can cause all kinds of trouble. Generally there are no consequences of this for you. If you build your own software and it requires this formula, you'll need to add to your build variables: LDFLAGS: -L/usr/local/opt/libxml2/lib CPPFLAGS: -I/usr/local/opt/libxml2/include ==> Summary 🍺 /usr/local/Cellar/libxml2/2.9.4_2: 277 files, 9.8M ==> Installing homebrew/php/php70 dependency: unixodbc ==> Downloading https://homebrew.bintray.com/bottles/unixodbc-2.3.4.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring unixodbc-2.3.4.sierra.bottle.tar.gz 🍺 /usr/local/Cellar/unixodbc/2.3.4: 39 files, 952.5K ==> Installing homebrew/php/php70 dependency: readline ==> Downloading https://homebrew.bintray.com/bottles/readline-7.0.1.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring readline-7.0.1.sierra.bottle.tar.gz ==> Caveats This formula is keg-only, which means it was not symlinked into /usr/local. macOS provides the BSD libedit library, which shadows libreadline. In order to prevent conflicts when programs look for libreadline we are defaulting this GNU Readline installation to keg-only. Generally there are no consequences of this for you. If you build your own software and it requires this formula, you'll need to add to your build variables: LDFLAGS: -L/usr/local/opt/readline/lib CPPFLAGS: -I/usr/local/opt/readline/include ==> Summary 🍺 /usr/local/Cellar/readline/7.0.1: 46 files, 2M Warning: homebrew/php/php70: this formula has no --with-fpm option so it will be ignored! Warning: homebrew/php/php70: this formula has no --without-apache option so it will be ignored! ==> Installing homebrew/php/php70 ==> Downloading https://homebrew.bintray.com/bottles-php/php70-7.0.14_7.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring php70-7.0.14_7.sierra.bottle.tar.gz ==> Caveats The php.ini file can be found in: /usr/local/etc/php/7.0/php.ini ✩✩✩✩ Extensions ✩✩✩✩ If you are having issues with custom extension compiling, ensure that you are using the brew version, by placing /usr/local/bin before /usr/sbin in your PATH: PATH="/usr/local/bin:$PATH" PHP70 Extensions will always be compiled against this PHP. Please install them using --without-homebrew-php to enable compiling against system PHP. ✩✩✩✩ PHP CLI ✩✩✩✩ If you wish to swap the PHP you use on the command line, you should add the following to ~/.bashrc, ~/.zshrc, ~/.profile or your shell's equivalent configuration file: export PATH="$(brew --prefix homebrew/php/php70)/bin:$PATH" ✩✩✩✩ FPM ✩✩✩✩ To launch php-fpm on startup: mkdir -p ~/Library/LaunchAgents cp /usr/local/opt/php70/homebrew.mxcl.php70.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php70.plist The control script is located at /usr/local/opt/php70/sbin/php70-fpm OS X 10.8 and newer come with php-fpm pre-installed, to ensure you are using the brew version you need to make sure /usr/local/sbin is before /usr/sbin in your PATH: PATH="/usr/local/sbin:$PATH" You may also need to edit the plist to use the correct "UserName". Please note that the plist was called 'homebrew-php.josegonzalez.php70.plist' in old versions of this formula. With the release of macOS Sierra the Apache module is now not built by default. If you want to build it on your system you have to install php with the --with-httpd24 option. See brew options php70 for more details. To have launchd start homebrew/php/php70 now and restart at login: brew services start homebrew/php/php70 ==> Summary 🍺 /usr/local/Cellar/php70/7.0.14_7: 332 files, 38.8M
設置php的全局變量
➜ ~ vi ~/.zshrc export LOCALBIN=/usr/local/bin export SBIN=/usr/sbin export PATH=$LOCALBIN:$SBIN:$PATH export PHPBIN=$(brew --prefix homebrew/php/php70)/bin export PATH=$PHPBIN:$PATH ➜ ~ source ~/.zshrc # 即時生效
安裝須要的php擴展
➜ ~ brew install homebrew/php/php70-gearman homebrew/php/php70-mongodb homebrew/php/php70-phalcon homebrew/php/php70-redis Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> New Formulae nativefier spdlog ==> Updated Formulae arangodb nghttp2 passenger ==> Installing php70-gearman from homebrew/php ==> Installing dependencies for homebrew/php/php70-gearman: boost, libevent, gearman ==> Installing homebrew/php/php70-gearman dependency: boost ==> Downloading https://homebrew.bintray.com/bottles/boost-1.63.0.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring boost-1.63.0.sierra.bottle.tar.gz 🍺 /usr/local/Cellar/boost/1.63.0: 12,491 files, 397.1M ==> Installing homebrew/php/php70-gearman dependency: libevent ==> Downloading https://homebrew.bintray.com/bottles/libevent-2.0.22.sierra.bottle.1.tar.gz ######################################################################## 100.0% ==> Pouring libevent-2.0.22.sierra.bottle.1.tar.gz 🍺 /usr/local/Cellar/libevent/2.0.22: 734 files, 2.0M ==> Installing homebrew/php/php70-gearman dependency: gearman ==> Downloading https://homebrew.bintray.com/bottles/gearman-1.1.14.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring gearman-1.1.14.sierra.bottle.tar.gz ==> Caveats To have launchd start gearman now and restart at login: brew services start gearman Or, if you don't want/need a background service you can just run: gearmand -d ==> Summary 🍺 /usr/local/Cellar/gearman/1.1.14: 211 files, 1.7M ==> Installing homebrew/php/php70-gearman ==> Downloading https://github.com/wcgallego/pecl-gearman/archive/gearman-2.0.1.tar.gz ==> Downloading from https://codeload.github.com/wcgallego/pecl-gearman/tar.gz/gearman-2.0.1 ######################################################################## 100.0% ==> /usr/local/opt/php70/bin/phpize ==> ./configure --prefix=/usr/local/Cellar/php70-gearman/2.0.1 --with-php-config=/usr/local/opt/php70/bin/php-config --with-gearman=/usr/local/opt/gearman ==> make ==> Caveats To finish installing gearman for PHP 7.0: * /usr/local/etc/php/7.0/conf.d/ext-gearman.ini was created, do not forget to remove it upon extension removal. * Validate installation via one of the following methods: * * Using PHP from a webserver: * - Restart your webserver. * - Write a PHP page that calls "phpinfo();" * - Load it in a browser and look for the info on the gearman module. * - If you see it, you have been successful! * * Using PHP from the command line: * - Run `php -i "(command-line 'phpinfo()')"` * - Look for the info on the gearman module. * - If you see it, you have been successful! ==> Summary 🍺 /usr/local/Cellar/php70-gearman/2.0.1: 7 files, 102.9K, built in 22 seconds ==> Installing php70-mongodb from homebrew/php ==> Downloading https://homebrew.bintray.com/bottles-php/php70-mongodb-1.2.2_1.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring php70-mongodb-1.2.2_1.sierra.bottle.tar.gz ==> Caveats To finish installing mongodb for PHP 7.0: * /usr/local/etc/php/7.0/conf.d/ext-mongodb.ini was created, do not forget to remove it upon extension removal. * Validate installation via one of the following methods: * * Using PHP from a webserver: * - Restart your webserver. * - Write a PHP page that calls "phpinfo();" * - Load it in a browser and look for the info on the mongodb module. * - If you see it, you have been successful! * * Using PHP from the command line: * - Run `php -i "(command-line 'phpinfo()')"` * - Look for the info on the mongodb module. * - If you see it, you have been successful! ==> Summary 🍺 /usr/local/Cellar/php70-mongodb/1.2.2_1: 3 files, 655.2K ==> Installing php70-phalcon from homebrew/php ==> Downloading https://homebrew.bintray.com/bottles-php/php70-phalcon-3.0.2.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring php70-phalcon-3.0.2.sierra.bottle.tar.gz ==> Caveats To finish installing phalcon for PHP 7.0: * /usr/local/etc/php/7.0/conf.d/ext-phalcon.ini was created, do not forget to remove it upon extension removal. * Validate installation via one of the following methods: * * Using PHP from a webserver: * - Restart your webserver. * - Write a PHP page that calls "phpinfo();" * - Load it in a browser and look for the info on the phalcon module. * - If you see it, you have been successful! * * Using PHP from the command line: * - Run `php -i "(command-line 'phpinfo()')"` * - Look for the info on the phalcon module. * - If you see it, you have been successful! ==> Summary 🍺 /usr/local/Cellar/php70-phalcon/3.0.2: 5 files, 3.5M ==> Installing php70-redis from homebrew/php ==> Downloading https://github.com/phpredis/phpredis/archive/3.0.0.tar.gz ==> Downloading from https://codeload.github.com/phpredis/phpredis/tar.gz/3.0.0 ######################################################################## 100.0% ==> /usr/local/opt/php70/bin/phpize ==> ./configure --prefix=/usr/local/Cellar/php70-redis/3.0.0 --with-php-config=/usr/local/opt/php70/bin/php-config ==> make ==> Caveats To finish installing redis for PHP 7.0: * /usr/local/etc/php/7.0/conf.d/ext-redis.ini was created, do not forget to remove it upon extension removal. * Validate installation via one of the following methods: * * Using PHP from a webserver: * - Restart your webserver. * - Write a PHP page that calls "phpinfo();" * - Load it in a browser and look for the info on the redis module. * - If you see it, you have been successful! * * Using PHP from the command line: * - Run `php -i "(command-line 'phpinfo()')"` * - Look for the info on the redis module. * - If you see it, you have been successful! ==> Summary 🍺 /usr/local/Cellar/php70-redis/3.0.0: 5 files, 405.3K, built in 20 seconds
直接運行,有報錯找不到配置文件。
$ php-fpm
[11-Jan-2014 16:03:03] ERROR: failed to open configuration file '/private/etc/php-fpm.conf': No such file or directory (2) [11-Jan-2014 16:03:03] ERROR: failed to load configuration file '/private/etc/php-fpm.conf' [11-Jan-2014 16:03:03] ERROR: FPM initialization failed
能夠在/private/etc/ 目錄下生成配置文件,須要root權限(sudo)
或者在普通用戶有權限的目錄裏放置配置文件,經過--fpm-config參數指定配置文件的位置,以下:
# cp /private/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf
$ php-fpm --fpm-config /usr/local/etc/php-fpm.conf
[11-Jan-2014 16:10:49] ERROR: failed to open error_log (/usr/var/log/php-fpm.log): No such file or directory (2) [11-Jan-2014 16:10:49] ERROR: failed to post process the configuration [11-Jan-2014 16:10:49] ERROR: FPM initialization failed
錯誤信息顯示:不能正確的打開」日誌「文件,緣由是默認在/usr/var目錄下工做,能夠修改配置文件指定正確的日誌文件路徑
$ vim /usr/local/etc/php-fpm.conf
修改php-fpm.conf文件中的error_log
項,默認前綴是/usr/var ,但並無這個路徑
error_log = /usr/local/var/log/php-fpm.log pid = /usr/local/var/run/php-fpm.pid
或者不修改配置文件中配置項的路徑,在php-fpm的運行參數中(-p)指定放置運行時文件的相對路徑前綴
$ php-fpm --fpm-config /usr/local/etc/php-fpm.conf --prefix /usr/local/var
到此,php-fpm守護進程已經基本能夠正確的啓動了。
下面咱們看下php.ini配置文件及擴展的安裝。
首先看下編譯參數,有些值是編譯進執行程序的,沒法更改。
$ php -i|grep config
找到配置文件(php.ini)、目錄的位置,下面兩項的值指定
'--with-config-file-path=/etc'
'--with-config-file-scan-dir=/Library/Server/Web/Config/php'
因此咱們須要在/etc目錄下建立php.ini,Mac在/private/etc,/etc下均提供了樣例文件php.ini.default,經過查驗,兩個文件徹底相同,因此複製哪個都無所謂,Mac有提供md5而不是Linux下的md5sum:
$ md5 /private/etc/php.ini.default /etc/php.ini.default
MD5 (/private/etc/php.ini.default) = 1c47241665ea5efdc55fd5809f675449
MD5 (/etc/php.ini.default) = 1c47241665ea5efdc55fd5809f675449
/etc目錄權限root:wheel,須要root權限或使用sudo,關於如何設置Mac的sudo命令須要的密碼,請查看
http://support.apple.com/kb/HT4103?viewlocale=zh_CN&locale=zh_CN
http://support.apple.com/kb/PH6515?viewlocale=zh_CN
# cp /etc/php.ini.default /etc/php.ini
變動own,之後修改不用總是切換root,生產環境最好不要改
# chown <你的用戶名> /etc/php.ini
# chmod u+w /etc/php.ini
php擴展介紹
php70-amqp 高級消息隊列協議 php70-ast 抽象語法樹 php70-blitz 用C語言開發的快速的PHP模板引擎 php70-couchbase 新興的NOSQL數據庫 php70-gearman 異步任務分發處理利器 php70-geoip 根據IP獲取地理位置及計算距離的方法,包括獲取目標IP所在的國家地區等信息 php70-gmagick 圖像生成和處理 php70-gmp 是一個開源的數學運算庫,它能夠用於任意精度的數學運算 php70-hprose 高性能遠程對象服務引擎 php70-ioncubeloader 加密PHP的工具 ...
加入開機自啓
➜ ~ cp /usr/local/opt/php70/homebrew.mxcl.php70.plist ~/Library/LaunchAgents/ ➜ ~ cp /usr/local/opt/php70/homebrew.mxcl.php70.plist /Users/cony/Library/LaunchAgents/ ➜ ~ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php70.plist ➜ ~ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.php70.plist
➜ ~ vi /usr/local/etc/nginx/servers/test.local.com.conf server { listen 80; server_name test.local.com; root /Users/cony/Work/php/test; location / { index index.html index.htm index.php; } 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; } } ➜ ~ sudo nginx -s reload ➜ ~ sudo vi /etc/hosts # 添加 127.0.0.1 test.local.com
連接:http://www.jianshu.com/p/ae3f88d52e21