nginx
配置文件
/usr/local/etc/nginx/servers
根目录
/usr/local/var/www
结合
server {
listen 80;
server_name shop.cloud.cn;
root /usr/local/var/www/blog;
location / {
index index.php index.html index.htm;
#laravel伪静态
#try_files $uri $uri/ /index.php$is_args$query_string;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
php
安装
- 查看可用的PHP版本
brew search php
- 安装PHP (这里的7.3为PHP版本, 可按自身系统配置.)
brew install php@7.3
- 需要将PHP加入$PATH
# 如果使用bash的话
vim ~/.bash_profile
export PATH="/usr/local/opt/php@7.3/bin:$PATH"
source ~/.bash_profile
# 如果使用ZSH的话
vim ~/.zshrc
export PATH="/usr/local/opt/php@7.3/bin:$PATH"
source ~/.zshrc
- 设置开机启动
mkdir -p ~/Library/LaunchAgents
ln -sfv /usr/local/opt/php71/homebrew.mxcl.php71.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php71.plist
- 查PHP环境设置
brew unlink php@5.6 //删除5.6版本链接
brew link php@7.2 //新建7.2版本链接
配置文件
/usr/local/etc/php/7.3
安装地址
/usr/local/opt/php@7.3
本文详细介绍了Nginx服务器配置及PHP环境的安装与设置过程,包括Nginx配置文件路径、监听端口、根目录设定,以及PHP版本安装、环境变量设置、开机启动配置等关键步骤。

2054

被折叠的 条评论
为什么被折叠?



