分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 代码编程

mac nginx 安装及PHP配置

发布时间:2023-09-06 02:18责任编辑:白小东关键词:PHP配置nginxmac

安装nginx 

1.安装brew命令

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

2.使用brew 安装nginx

brew install nginx

3.修改配置nginx 文件 (文件应该在 /usr/local/etc/nginx/nginx.conf)

server { ???????listen ??????8080; ???????server_name ?localhost; ???????#charset koi8-r; ???????#access_log ?logs/host.access.log ?main; ???????location / { ???????????root ??/you/web/path; #配置web目录 ???????????#root /usr/local/var/www; ???????????autoindex on; ???????????index ?index.html index.htm index.php; #添加php默认 ???????}

(开启PHP支持)修改为如下

location ~ \.php$ { ???????????root ??????????/you/web/path; ???????????#root /usr/local/var/www; ???????????fastcgi_pass ??127.0.0.1:9000; ???????????fastcgi_index ?index.php; ???????????#fastcgi_param ?SCRIPT_FILENAME ?/scripts$fastcgi_script_name; ???????????fastcgi_param ?SCRIPT_FILENAME ?$document_root$fastcgi_script_name; ???????????include ???????fastcgi_params; }

4.启动nginx

sudo nginx

5.有些情况需要打开,php-fpm 否则会报服务器错误~

sudo php-fpm

  

mac nginx 安装及PHP配置

原文地址:https://www.cnblogs.com/zjhblogs/p/9821229.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved