archlinux安装nginx

安装nginx

sudo pacman -S nginx

查询nginx配置文件位置

sudo nginx -t

运行结果如下:

[itkey@archlinux ~]$ sudo nginx -t
2021/03/28 10:29:01 [warn] 1503#1503: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64; ignoring types_hash_bucket_size
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

解决警告

警告信息如下:

[warn] 1503#1503: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64; ignoring types_hash_bucket_size

解决办法:
修改 /etc/nginx/nginx.conf 配置文件,增加

# 长连接超时时间,单位是秒
 types_hash_max_size 4096;

在这里插入图片描述
这下运行就没有警告啦!

运行结果如下:
[itkey@archlinux ~]$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

没有警告就是开心。

修改配置以后重启 nginx

nginx -s reload

重启报错解决办法

服务器重启之后,执行 nginx -t 是OK的,然而在执行 nginx -s reload 的时候报错

nginx: [error] invalid PID number “” in “/run/nginx.pid”

解决方法:

需要先执行

nginx -c /etc/nginx/nginx.conf

nginx.conf文件的路径可以从nginx -t的返回中找到。

nginx -s reload

参考

https://stackoverflow.com/questions/46031491/nginx-on-fedora-26-could-not-build-optimal-types-hash-error-message

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值