安装nginx 1.安装brew命令ruby -e $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)2.使用brew 安装nginxbrew install nginx3.修改配置nginx 文件 (文件应该在 /usr/local/etc/...
安装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配置
基础教程推荐
猜你喜欢
- PHP实现生成数据字典功能示例 2022-10-18
- TP5(thinkPHP5框架)基于bootstrap实现的单图上传插件用法示例 2023-01-19
- thinkPHP3.2.2框架行为扩展及demo示例 2022-11-07
- laravel model模型定义实现开启自动管理时间created_at,updated_at 2023-03-02
- PHP删除数组中指定值的元素常用方法实例分析【4种方法】 2022-11-12
- PHP数据加密方式梳理介绍 2023-07-03
- TP5 连接多个数据库及使用方法 2023-08-30
- PHP实现创建一个RPC服务操作示例 2023-04-01
- php中使用array_filter()函数过滤数组实例讲解 2023-05-19
- PHP使用SMTP邮件服务器发送邮件示例 2022-11-16
