国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

Mac 下 Nginx、PHP、MySQL 和 PHP-fpm 的安裝和配置

shenhualong / 2467人閱讀

摘要:原文下和的安裝和配置個人博客永久地址。安裝之前,先安裝命令行工具,安裝成功后,打開的應用,查看是否為最新,如果不是最新的請在中升級。接下來,我們執行一些簡單的配置命令。下面給出一份文件夾下的的配置。

原文:Mac 下 Nginx、PHP、MySQL 和 PHP-fpm 的安裝和配置
個人博客永久地址。

文章做了更新,增加了php-fpm的配置相關信息。

雜七雜八的雜

Mac下搭建MNPM環境是每個使用者mac的phper必備的技能。一般都是找到新工作入職的第一天做的事情--配置環境。

如上,今天入職的,配置開發環境。公司配備的硬件設備很屌,15年產macbook pro筆記本一臺(13寸),配置了8GB DDR3內存,2.7GHz core i5處理器,120GB的閃存。當然了,沒我自己買的配置高,哈哈~~

安裝 Mac 的包管理器 - homebrew

home-brew是什么?先這樣說吧,home-brew與OS X就像nodes與npm,java與maven(或者gradle),php與composer,apt-get與Ubutun,yum與centos,還有其他等等吧,都是宿主的開發工具或包的依賴管理。

安裝Homebrew之前,先安裝xcode命令行工具,安裝成功后,打開xcode的應用,查看Xcode是否為最新,如果不是最新的請在App Store中升級Xcode。

安裝xcode命令行工具的命令:

xcode-select --install

安裝完后,請使用brew doctor命令檢查當前環境是否最新符合brew運行,如果xcode的版本太低,則會有相應的提示信息。

home-brew的安裝很容易,只要你的客戶終端安裝了ruby即可,其實,你一點都不用擔心此事,OS X系統已經預裝了ruby。

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

網上很多關于安裝homebrew的文章相較時間早,所以很多文章依然提供下面這種安裝,其實測試發現改地址已經返回404,并不能提供資源服務。

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

關于Homebrew的更多知識,請參見下面幾個站點的鏈接。

OS X 不可或缺的套件管理器

homebrew的Github地址

Mac系統下類似于apt-get的軟件包管理器--Homebrew

安裝 Nginx 服務器

安裝好了Homebrew之后,便可以使用brew命令來安裝相應的包了。接下來,安裝nginx服務器。

brew install nginx

如果需要安裝nginx的其他版本,可以使用brew edit nginx來修改其內容:

> class Nginx < Formula   desc "HTTP(S) server and reverse proxy, and
> IMAP/POP3 proxy server"   homepage "http://nginx.org/"   url
> "http://nginx.org/download/nginx-1.10.0.tar.gz"   sha256
> "8ed647c3dd65bc4ced03b0e0f6bf9e633eff6b01bac772bcf97077d58bc2be4d"  
> head "http://hg.nginx.org/nginx/", :using => :hg
> 
> bottle do
> sha256 "69839647f12306f8756eb7934eed946e55ffb47c1a2813f126523d824cd53a9d" =>
> :el_capitan
> sha256 "af4b2cad55c8414c2c29db340c94da9270ec66044f8a52f1d0e0efe1f11adb9b" =>
> :yosemite
> sha256 "8bc5364108c213b062427a98b361d3caf91e8f5a8ef518f23954bdb41e10b9df" =>
> :mavericks   end
> 
>  #Before submitting more options to this formula please check they
> aren"t   # already in Homebrew/homebrew-nginx/nginx-full:   #
> https://github.com/Homebrew/homebrew-nginx/blob/master/Formula/nginx-full.rb
> option "with-passenger", "Compile with support for Phusion Passenger module"   option "with-webdav", "Compile with support for WebDAV module"   option "with-debug", "Compile with support for debug log"

??

從上面信息可以看出nginx的下載地址等信息,可以根據自己的需求修改。

brew執行完之后,nginx服務器就算安裝好了,運行下面幾條命了測試一下:

# 啟動 nginx服務
sudo nginx

# 重新加載配置|重啟|停止|退出 nginx
nginx -s reload|reopen|stop|quit

#測試配置是否有語法錯誤
nginx -t

nginx啟動后,在瀏覽器中輸入http://localhost:8080/,回車即可看到運行結果,顯示的是/usr/local/Cellar/nginx/1.10.0/html/index.html文件的內容。

相關參數可自行修改,具體怎么配置nginx,請參看nginx的配置。

實際上,nginx服務的啟動可以用-c nginx的配置文件參數制定其配置文件,默認加載/usr/local/etc/nginx/nginx.conf文件,當然nginx的操作不止這些命令,還有一些信號操作,關于nginx的信號操作等知識,留在它章詳細的說一下。

# 啟動 nginx
sudo ngixn -c /usr/local/etc/nginx/nginx.conf

#測試配置是否有語法錯誤
nginx -t -c /usr/local/etc/nginx/nginx.conf

補充

開機自啟動nginx服務設置:

mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/nginx/1.10.0/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist

配置非管理員開機nginx自動啟動的權限和分組:

sudo chown root:wheel /usr/local/Cellar/nginx/1.10.0/sbin/nginx
sudo chmod u+s /usr/local/Cellar/nginx/1.10.0/sbin/nginx

說明:{尊重知識,尊重別人的勞動成果}
參考文章:Mac下Nginx、MySQL、PHP-FPM的安裝配置

安裝和配置 MySQL 服務器

安裝mysql同nginx一樣簡單,執行brew命令:

brew install mysql

執行完brew命令,如果沒有出錯,mysql算是安裝到本機或者服務器了,當然,此過程會看到很多信息打印到shell窗口。

接下來,我們執行一些簡單的配置命令。

a.初始化mysql數據庫:

mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql

這里需要說明一下,網上很多資料顯示需要tmpdir參數,如下:

mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

這個會出錯,具體原因暫時不知道,在segmentfault上有人提問過了,目前沒有完美的答案。

b.查看mysql數據庫是否啟動,如果沒有啟動則使用mysqld命令啟動。

ps -ef | grep mysql

如果沒有啟動,使用安裝的mysql目錄下的mysqld命令啟動mysql:

/usr/local/Cellar/mysql/5.7.12/bin/mysqld

當然,你可直接使用/usr/local/bin/mysqld就可以啟動mysql服務。

which mysqld

結果發現:

> MacBook-Pro:joyven $ which mysql
> /usr/local/bin/mysqld

此時的數據庫沒有密碼,即使是root用戶,也無需密碼就可登錄到數據庫服務。因此,需要設置數據庫密碼:

/usr/local/bin/mysqladmin -u root password "new-password"

現在訪問 mysql 還是不用密碼就可以連接,如果要設置一些登陸密碼的安全訪問限制,則需執行下面的 mysql安全安裝指令:

/usr/local//bin/mysql_secure_installation

主要是設置修改root密碼(設置過了可以不用設置,略過)、刪除匿名訪問、刪除root網絡訪問、刪除test數據庫。指令執行完后,登陸mysql就需要密碼驗證了:

mysql -u root -p

開機啟動 mysql

mkdir -p ~/Library/LaunchAgents/
cp /usr/local/Cellar/mysql/5.7.12/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

如果要停止 mysql 服務則:

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
安裝 PHP56 和 PHP-fpm

php的安裝很簡單,php-fpm目前已經集成到php的內核,可以當作內核來安裝了。很久以前不是哦,請注意,我不記得是什么時候加入到內核的,如果你樂意查,查了請在評論區告訴我一下。

至于他為什么是內核的原因,參考《搞不清FastCgi與PHP-FPM之間是個什么樣的關系》的提問,主要看看下面各位大神@的回答。

安裝php之前,請先用brew tap命令引入第三方的php庫,brew倉庫中沒有php的安裝包。

brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php

萬事俱備,只欠東風,不,只欠一條命令。

brew install php56 --with-imap --with-tidy --with-debug --with-pgsql --with-mysql --with-fpm

下面是輸出的信息:

brew install php56 --with-imap --with-tidy --with-debug --with-pgsql --with-mysql --with-fpm --with-curl=/usr/local/Cellar/curl/
==> Installing php56 from josegonzalez/php
==> Installing dependencies for josegonzalez/php/php56: readline, postgre
==> Installing josegonzalez/php/php56 dependency: readline
==> Downloading https://homebrew.bintray.com/...
####################################################################### 100.0%
==> Pouring readline-6.3.8.el_capitan.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

OS X 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/6.3.8: 46 files, 2.0M
==> Installing josegonzalez/php/php56 dependency: postgresql
==> Downloading https://homebrew.bintray.com/...
######################################################################## 100.0%
==> Pouring postgresql-9.5.2.el_capitan.bottle.1.tar.gz
==> /usr/local/Cellar/postgresql/9.5.2/bin/initdb /usr/local/var/postgres
==> Caveats
If builds of PostgreSQL 9 are failing and you have version 8.x installed,you may need to remove the previous version first. See:
https://github.com/Homebrew/h...

To migrate existing data from a previous major version (pre-9.0) of PostgreSQL, see:
https://www.postgresql.org/do...

To migrate existing data from a previous minor version (9.0-9.4) of PosgresSQL, see:
https://www.postgresql.org/do...

You will need your previous PostgreSQL installation from brew to perform pg_upgrade.
Do not run brew cleanup postgresql until you have performed the migration.

To have launchd start postgresql now and restart at login:
brew services start postgresql
Or, if you don"t want/need a background service you can just run:
postgres -D /usr/local/var/postgres
==> Summary
? /usr/local/Cellar/postgresql/9.5.2: 3,135 files, 34.9M
==> Installing josegonzalez/php/php56 dependency: libpng
==> Downloading https://homebrew.bintray.com/...
######################################################################## 100.0%
==> Pouring libpng-1.6.21.el_capitan.bottle.tar.gz
? /usr/local/Cellar/libpng/1.6.21: 25 files, 1.2M
==> Installing josegonzalez/php/php56 dependency: freetype
==> Downloading https://homebrew.bintray.com/...
######################################################################## 100.0%
==> Pouring freetype-2.6.3.el_capitan.bottle.tar.gz
? /usr/local/Cellar/freetype/2.6.3: 61 files, 2.5M
==> Installing josegonzalez/php/php56 dependency: gettext
==> Downloading https://homebrew.bintray.com/...
######################################################################## 100.0%
==> Pouring gettext-0.19.7.el_capitan.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

OS X 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.7: 1,934 files, 16.7M
==> Installing josegonzalez/php/php56 dependency: icu4c
==> Downloading https://homebrew.bintray.com/...
######################################################################## 100.0%
==> Pouring icu4c-57.1.el_capitan.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

OS X 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/57.1: 265 files, 65.0M
==> Installing josegonzalez/php/php56 dependency: imap-uw
==> Downloading https://homebrew.bintray.com/...
######################################################################## 100.0%
==> Pouring imap-uw-2007f.el_capitan.bottle.tar.gz
? /usr/local/Cellar/imap-uw/2007f: 151 files, 9.0M
==> Installing josegonzalez/php/php56 dependency: jpeg
==> Downloading https://homebrew.bintray.com/...
######################################################################## 100.0%
==> Pouring jpeg-8d.el_capitan.bottle.2.tar.gz
? /usr/local/Cellar/jpeg/8d: 19 files, 713.7K
==> Installing josegonzalez/php/php56 dependency: libxml2
==> Downloading https://homebrew.bintray.com/...
######################################################################## 100.0%
==> Pouring libxml2-2.9.3.el_capitan.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

OS X 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.3: 276 files, 9.8M
==> Installing josegonzalez/php/php56 dependency: unixodbc
==> Downloading https://homebrew.bintray.com/...
######################################################################## 100.0%
==> Pouring unixodbc-2.3.4.el_capitan.bottle.tar.gz
? /usr/local/Cellar/unixodbc/2.3.4: 39 files, 952.3K
Warning: josegonzalez/php/php56: --with-pgsql was deprecated; using --with-postgresql instead!
==> Installing josegonzalez/php/php56
==> Downloading https://php.net/get/php-5.6.2...
==> Downloading from https://secure.php.net/distri...
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/php56/5.6.21 --localstatedir=/usr/loc
==> make
==> make install
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:

LoadModule php5_module    

/usr/local/opt/php56/libexec/apache2/libphp5.so

The php.ini file can be found in:

/usr/local/etc/php/5.6/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"

PHP56 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/php56)/bin:$PATH"

???? FPM ????

To launch php-fpm on startup:

mkdir -p ~/Library/LaunchAgents
cp /usr/local/opt/php56/homebrew.mxcl.php56.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist

The control script is located at /usr/local/opt/php56/sbin/php56-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.php56.plist" in old versions of this formula.

To have launchd start josegonzalez/php/php56 now and restart at login:
brew services start josegonzalez/php/php56
==> Summary
? /usr/local/Cellar/php56/5.6.21: 331 files, 56.2M, built in 8 minutes 14 seconds

我我什么要把這些信息貼出來,原因很簡單,這些信息給我給出了我們安裝是否成功,安裝在那個路徑下了,接下來我們還需要手動做些什么(比如開機啟動等)。

由于Mac系統預裝了php以及php-fpm,所以,為了啟動的時候能直接啟動安裝的最新的php,請把php安裝的二進制文件所在的路徑加入到系統路徑中,這個地方需要注意了。如果我們設置了開機的時候自動啟動,我們不會發現有什么問題,可是當我重新配置了擴展,需要重新啟動php-fpm的時候,我們如果直接使用php-fpm -c /usr/local/etc/php/5.6/php.ini -y /usr/local/ext/php/5.6/php-fpm.conf的時候,我們發現我們的擴展安裝沒有起作用,原因是我們使用了/usr/sbin/php-fpm的命令,可以通過which查看。所以需要注意,使用brew安裝的php-fpm是在/usr/local/opt/php56/目錄下面。

export PATH="$(brew --prefix php54)/bin:$PATH"

到此,php以及PHP-fpm已經安裝成功了。那么我們還是設置php-fpm開機啟動,在哪里找這段代碼呢,安裝過程打印的信息,也就是我為什么要把安裝過程信息完完整整貼一遍的原因:

mkdir -p ~/Library/LaunchAgents
cp /usr/local/opt/php56/homebrew.mxcl.php56.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist

ps:
順便說一下或許對你在安裝過程很有用的命令:

殺死一個進程的命令:

    sudo kill -9 pid #pid替換為你的進程號

比如你要殺死php-fpm進程,也可以使用如下命令:

    sudo killall php-fpm
    // 或者
    sudo killall -HUP php-fpm

如何查看進程號:

    ps -ef | grep php-fpm
配置 Nginx 服務器

Nginx服務器的配置,這里只作簡單的配置部分說明,至于想對較為繁瑣的配置,比如ip_hash,upstream,gzip,反向代理等內容放到它章作解。

假如你的網站根目錄是在/var/www下面,那么我們只需配置一個簡單的站點作為nginx配置的開始。

前面說過了,Mac下nginx的配置文件的默認存放路徑--/usr/local/etc/nginx/,改文件下包括如下幾個文件(夾):

fastcgi.conf

mime.types

servers

fastcgi.conf.default

mime.types.default

sites-enabled

fastcgi_params

nginx.conf

uwsgi_params

fastcgi_params.default

nginx.conf.default

uwsgi_params.default

koi-utf

scgi_params

win-utf

koi-win

scgi_params.default

默認情況下,沒有sites-enabled這個文件夾,這個時我們為了方便管理配置的server節點,創建的一個文件夾。創建命令:sudo mkdir sites-enabled

配置中經常用到一個nginx的參數,提供參數的兩個文件時fastcgi.conf和fastcgi_params,這兩個文件除了SCRIPT_FILENAME這個參數之外,其他一模一樣,為什么要一模一樣呢,具體自省Google,這里是說,先有fastcgi_params,后有fastcgi.conf,所以大多數的時候我們看到配置中很多人還是喜歡繼續用fastcgi_params。

nginx.conf的基本配置:

#user  nobody;
worker_processes  4;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  "$remote_addr - $remote_user [$time_local] "$request" "
                      "$status $body_bytes_sent "$http_referer" "
                      ""$http_user_agent" "$http_x_forwarded_for"";

    access_log  /usr/local/var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        charset utf-8;

        access_log  /usr/local/var/log/nginx/localhost.access.log  main;

        root /var/www;
        location / {
            #root   html;
            index  index.html index.htm index.php;
            try_files $uri /$uri index.php?$args;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ .php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ .php$ {
            #root           /var/www;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /var/www$fastcgi_script_name;
            include        fastcgi_params;
        }

        # deny access to .htaccess files, if Apache"s document root
        # concurs with nginx"s one
        #
        location ~ /.ht {
            deny  all;
        }
    }

    include sites-enabled/nginx-*.conf;

    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
    
    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
    #include servers/*;
}

上面的太亂了,我們簡化一下吧:

worker_processes  4;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  "$remote_addr - $remote_user [$time_local] "$request" "
                      "$status $body_bytes_sent "$http_referer" "
                      ""$http_user_agent" "$http_x_forwarded_for"";

    access_log  /usr/local/var/log/nginx/access.log  main;

    sendfile        on;
    keepalive_timeout  65;


    server {
        listen       80;
        server_name  localhost;

        charset utf-8;

        access_log  /usr/local/var/log/nginx/localhost.access.log  main;

        root /var/www; #你的網站根目錄
        location / {
            index  index.html index.htm index.php;
        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  /var/www$fastcgi_script_name;
            include        fastcgi_params;
        }
   
        location ~ /.ht {
            deny  all;
        }
    }

    include sites-enabled/nginx-*.conf;   
}

這是一份相對簡單的nginx配置,相對復雜一點的配置會在復雜的場景中使用,一般初步開發這些就可以滿足了。

下面給出一份sites-enabled文件夾下的nginx的配置。需要說明的是,上面的配置中的server節點中的內容,包括server,可以多帶帶拿出來,放在一份多帶帶的配置中,由最后一句的include的命令引入。

nginx-test.conf

server {
    listen 80;
    server_name test-local.com;

    charset utf-8;
    access_log /usr/local/var/log/nginx/test-local.com.access.log main;
    error_log /usr/local/var/log/nginx/test-local.com.error.log;

    root /var/www/test-php/backend/web;

    location / {
        try_files $uri $uri/ /index.php?$args;
        index index.html index.htm index.php;
    }

    location ~ .php$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /var/www/test-php/backend/web$fastcgi_script_name;
        include fastcgi_params;
        try_files $uri =404;
    }
}     

如上,打開瀏覽器輸入http://localhost/訪問第一個server節點配置的服務,輸入http://test-local.com/訪問第二個server節點。

但是,別太急,請修改hosts的host配置,打開/etc/hosts文件,加入一行:

127.0.0.1 test-local.com
結束之前,擴展幾點

大多數時候,我們不得不安裝php的擴展,比如 GD,mcrypt,CURL,XML,MEMCACHED 等擴展配置,這些東西在我們的開發中常常用到,對于幾個相對較難的擴展,做一些記錄吧。

curl安裝

mcrypt安裝

memcached安裝

2016-05-09 23:48 殘片斷章
2016-05-10 23:18 補充php和php-fpm的安裝

-------------------------------------------?歉意的分割線-----------------------------------------------------
sorry,由于篇幅很長了,php的擴展安裝多帶帶放在下一章節中,請見諒,寫完后,會將鏈接附上!

2016-05-10 23:19 致歉
補充:
mac下安裝php擴展:

brew install php56-apcu php56-intl php56-redis php56-uuid php56-zookeeper 
    php56-thrift php56-solr php56-ssh2 php56-gmagick php56-kafka php56-libevent 
    php56-imagick php56-msgpack php56-geoip php56-mcrypt php56-swoole 
    php56-scrypt php56-xdebug php56-yaf php56-yaml php56-xhprof 
    php56-memcache php56-memcached php56-gearman

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/39290.html

相關文章

  • Mac OS 10.12 Sierra 用HomeBrew安裝MNMP開發環境 (Mac+Nginx

    原文地址:http://www.zhoujiping.com/notes/mnmp.html 2011年的MacBook Pro(機械硬盤,8G內存),之前升級到Mac 10.11,但會經常的卡頓,所以一直使用的是Mac 10.10系統,最近不知道怎么了,瀏覽器在后臺會自動播放廣告聲音,現在mac 10.12出來了,該系統除了添加Siri,基本上就是10.11的一個升級,嘗試下載安裝,很好,竟然跑...

    Riddler 評論0 收藏0
  • Mac OS 10.12 Sierra 用HomeBrew安裝MNMP開發環境 (Mac+Nginx

    原文地址:http://www.zhoujiping.com/notes/mnmp.html 2011年的MacBook Pro(機械硬盤,8G內存),之前升級到Mac 10.11,但會經常的卡頓,所以一直使用的是Mac 10.10系統,最近不知道怎么了,瀏覽器在后臺會自動播放廣告聲音,現在mac 10.12出來了,該系統除了添加Siri,基本上就是10.11的一個升級,嘗試下載安裝,很好,竟然跑...

    13651657101 評論0 收藏0
  • MacNginxPHPMySQL PHP-fpm安裝配置

    摘要:安裝之前,需要確定是否安裝過然后安裝命令行工具。安裝命令行工具如果該方法你不愿用或者各種原因,可以登錄然后下載安裝注一定要選擇和系統版本,版本一致的命令行工具。安裝好了之后,便可以使用命令來安裝相應的包了。 之前換電腦裝了個Mnmp,有遇到一些小坑,寫在這,希望能幫到一些初次搭建Mnmp的phper。 ... 安裝 Mac 的包管理器 - homebrew Homebrew是一款Mac...

    fireflow 評論0 收藏0
  • MacNginxPHPMySQL PHP-fpm安裝配置

    摘要:安裝之前,需要確定是否安裝過然后安裝命令行工具。安裝命令行工具如果該方法你不愿用或者各種原因,可以登錄然后下載安裝注一定要選擇和系統版本,版本一致的命令行工具。安裝好了之后,便可以使用命令來安裝相應的包了。 之前換電腦裝了個Mnmp,有遇到一些小坑,寫在這,希望能幫到一些初次搭建Mnmp的phper。 ... 安裝 Mac 的包管理器 - homebrew Homebrew是一款Mac...

    animabear 評論0 收藏0

發表評論

0條評論

最新活動
閱讀需要支付1元查看
<