之前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,会出现以下的错
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、