nginx编译遇到的环境问题

来源:互联网 发布:lol区服网络地区 编辑:程序博客网 时间:2024/05/08 05:38

安装nginx过程,遇到的问题


一、编译pcre时,报如下错误

PCRE libtool: unrecognized option `-DHAVE_CONFIG_H'


原因:缺少 gcc-c++

安装:yum install gcc-c++


二、环境缺少unzip命令

安装:yum install unzip


三、为nginx打补丁,报”patch : command not found“

安装:yum install patch


四、启动nginx时,报”/usr/local/nginx/sbin/nginx: error while loading shared libraries: libprofiler.so.0: cannot open shared object file: No such file or directory“


解决思路:

1、查找该文件



2、编辑 ”/etc/ld.so.conf“文件,将 ”/usr/local/lib/“目录,加入其中,执行ldconfig


五、启动nginx时,报”nginx: [emerg] could not build the types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 32“错误


解决思路:

在nginx http部分增加

types_hash_max_size 2048;
server_names_hash_max_size 1024;


六、在使用nginx过程中,不太想使用swap交换空间

1、编辑 /etc/sysctl.conf,增加 vm.swappiness key条目,数值约低,使用swap交换空间的可能性越小

eg:

  vm.swappiness = 10


2、sysctl -p 使配置生效


0 0
原创粉丝点击