Home >Backend Development >PHP Tutorial >mac 配置nginx+php

mac 配置nginx+php

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-23 13:36:51996browse

系统: OS X Yosemite 10.10.1

系统自带php和php-fpm

路径备注:

php.ini : /etc/

php-fpm.conf :/etc/

nginx.conf :/usr/local/etc/nginx/nginx.conf

nginx 默认root:/usr/local/opt/nginx/html


1.安装nginx,我使用了brew

brew install nginx

2.启动php-fpm

sudo php-fpm
如果报错的话,复制php-fpm.conf.default一份,修改php-fpm.conf的error_log 存放的路径或启动的端口

3.打开nginx.conf

开启php的注释,配置好自己的root

          location ~ \.php$ {              root           /Users/maming/php;              fastcgi_pass   127.0.0.1:9000;              fastcgi_index  index.php;              fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;              include        fastcgi_params;          }

注意

SCRIPT_FILENAME  /script$fastcgi_script_name;

要改成

SCRIPT_FILENAME  $document_root$fastcgi_script_name;

否则回报文件不存在的。

4.开启nginx

sudo nginx

或重启

sudo nginx -s reload


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php错误提示Next article:PHP中文乱码问题