揀點芝麻-Mac Nginx Php配置
阿新 • • 發佈:2019-01-29
之前Nginx丟了東西,今天一時興起,揀點過去的芝麻--Mac Nginx Php配置
Nginx之前一片寫到mac 安裝 nginx 環境,不會Mac Nginx安裝的,可以安裝,也是簡單的很。
1、Nginx 的命令還是比較方便,nginx -V(大寫V) 就可以看到所有有關nginx 在系統目錄配置
nginx version: nginx/1.4.7
TLS SNI support enabled
configure arguments: --prefix=/usr/local/Cellar/nginx/1.4.7 --with-http_ssl_module --with-pcre --with-ipv6 --sbin-path=/usr/local/Cellar/nginx/1.4.7/bin/nginx --with-cc-opt='-I/usr/local/Cellar/pcre/8.34/include -I/usr/local/Cellar/openssl/1.0.1f/include' --with-ld-opt='-L/usr/local/Cellar/pcre/8.34/lib -L/usr/local/Cellar/openssl/1.0.1f/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/run/nginx.lock --http-client-body-temp-path=/usr/local/var/run/nginx/client_body_temp --http-proxy-temp-path=/usr/local/var/run/nginx/proxy_temp --http-fastcgi-temp-path=/usr/local/var/run/nginx/fastcgi_temp --http-uwsgi-temp-path=/usr/local/var/run/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/var/run/nginx/scgi_temp --http-log-path=/usr/local/var/log/nginx/access.log --error-log-path=/usr/local/var/log/nginx/error.log --with-http_gzip_static_module
2、安裝php-fpm,這個整的挺久
Mac OS X 10.9已經自帶有php-fpm,對於有乾淨系統強迫症的人,可以用brewhome重灌一遍。
直接在mac下執行php-fpm,會出現以下的錯
使用下面的命令cp一份,到php目錄,並且config下Draco:etc root# php-fpm [23-Mar-2014 21:24:31] ERROR: failed to open configuration file '/private/etc/php-fpm.conf': No such file or directory (2) [23-Mar-2014 21:24:31] ERROR: failed to load configuration file '/private/etc/php-fpm.conf' [23-Mar-2014 21:24:31] ERROR: FPM initialization failed
Draco:etc root# cp /private/etc/php-fpm.conf.default /usr/local/etc/php/5.4/php-fpm.conf
Draco:etc root# php-fpm --fpm-config /usr/local/etc/php/5.4/php-fpm.conf [23-Mar-2014 22:01:58] ERROR: failed to open error_log (/usr/var/log/php-fpm.log): No such file or directory (2) [23-Mar-2014 22:01:58] ERROR: failed to post process the configuration [23-Mar-2014 22:01:58] ERROR: FPM initialization failed Draco:etc root#
出現上面的錯誤是由於php-fpm日誌路徑錯誤,修改下php-fpm.conf的配置
vi /usr/local/etc/php/5.4/php-fpm.conf
到此,php-fpm守護程序已經基本可以正確的啟動了。
2、上面可以看到nginx.conf,vi下,找到如下一行,預設是被註釋的了
location ~ \.php$ {
proxy_pass http://127.0.0.1;
}
3、