- 使用brew安装git:
- 使用brew安装nginx:
1.brew install nginx #进行nginx 安装
2.sudo nginx #启动nginx 浏览器输入127.0.0.1:8080访问成功
3.sudo nginx -s reload #重新加载配置
4.sudo nginx -s stop #停止nginx
5./usr/local/etc/nginx/nginx.conf #配置文件路径
6./usr/local/var/www #项目根目录
- brew uninstall nginx #卸载
- brew list #查看已安装扩展
- brew update nginx #更新
- ps -ef|grep nginx #查看nginx进程 (注意有nginx: maste就是启动成功)
- 浏览器访问localhost:8080不成功的注意点
- 1.看看自己是不是墙了,墙了就把墙关掉再访问
- 2.用127.0.0.1:8080访问看看是否成功
- 3.检查/etc/hosts 文件 指定::1 localhost , 127.0.0.1 localhost
- 使用brew安装php
- brew tap homebrew/dupes
- brew tap homebrew/versions
- brew tap homebrew/php
- brew search php #查看PHP版本和扩展
- brew install php71 #对PHP进行安装,安装过程缓慢,要加载很多扩展
- 1.brew link php71 #启动PHP
- 如果出现warning不能启动解决办法
- brew upgrade php71-igbinary #进行更新
- brew install php71-igbinary #如果提示没有安装则进行安装
- php -v #查看php版本
- php unlink php71 #关闭PHP
- 2.vim /usr/local/etc/php/7.1/php-fpm.conf
pid = /usr/local/var/run/php-fpm.pid
error_log = /usr/local/var/log/php-fpm.log
sudo /usr/local/Cellar/php71/7.1.12_23/sbin/php-fpm -D #启动php-fpm
sudo killall php-fpm #关闭
lsof -Pni4|grep LISTEN | grep php #查看php-fpm
修改nginx配置文件 启动
vim /usr/local/etc/nginx/nginx.conf
server 下修改
location / {
root html;
index index.html index.htm index.php;
}
location ~ \.php$ {
root html;
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;
}
保存并启动 sudo nginx 访问 127.0.0.1:8080 就可用.php文件了
网友评论