最近macos 使用brew upgrade 更新了nginx ,然后postman调试接口的时候报错。发现是/usr/local/var/run/nginx/client_body_temp 目录没有权限,网上的做法是sudo chown -R nobody:nobody /usr/local/var/run/nginx/proxy_temp/,我试着做了。但是没起作用,然后改了下权限。可以了。sudo chmod -R 775 /usr/local/var/run/nginx/proxy_temp/
Debian9 安装稳定版本的nginx
- 先安装依赖组件
sudo apt install curl gnupg2 ca-certificates lsb-release
2. 再仓库里生成list文件
echo "deb http://nginx.org/packages/debian `lsb_release -cs` nginx" \
| sudo tee /etc/apt/sources.list.d/nginx.list
3. 增加key
curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
4. 校验key
sudo apt-key fingerprint ABF5BD827BD9BF62
如果看到以下命令,表明成功
pub rsa2048 2011-08-19 [SC] [expires: 2024-06-14]
573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62
uid [ unknown] nginx signing key <signing-key@nginx.com>
5. 安装nginx
sudo apt update
sudo apt install nginx
Nginx 增加错误页配置
在配置文件中增sever块里增加以下代码:
error_page 404 403 500 503 503 504 /404.html;
location = /404.html {
root 路径;
}