标签:服务 mac nginx server cat path local home highlight fpm
安装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 server cat path local home highlight fpm
原文地址:https://www.cnblogs.com/zjhblogs/p/9821229.html