zoukankan      html  css  js  c++  java
  • Nginx编译安装

    一、编译安装

    1、上传压缩包到虚机里,rz nginx-1.3.15.tar.gz

    2、解压 tar zxvf nginx-1.3.15.tar.gz

    3、进到文件夹 cd nginx-1.3.15

    4、编译安装:./configure --prefix=/usr/local/nginx     (这里是安装到usr/local/nginx

             make && make install

    5、验证是否安装成功,访问本机ip即可(如果访问不了,关闭防火墙 service iptables stop

    二、遇到的问题

    1、./configure: error: the HTTP rewrite module requires the PCRE library.

    解决方法:安装pcre-devel解决问题,yum -y install pcre-devel

    2、./configure: error: the HTTP cache module requires md5 functions
    from OpenSSL library.   You can either disable the module by using
    --without-http-cache option, or install the OpenSSL library into the system,
    or build the OpenSSL library statically from the source with nginx by using
    --with-http_ssl_module --with-openssl=<path> options.

    解决方法:yum -y install openssl openssl-devel

    3、在使用./nginx -s reload时,报错nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)

    解决方法:/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

    三、使用

    1、启动

    切换到安装目录 cd /usr/loacl/nginx/sbin  >> ./nginx

    2、查看nginx是否启动成功

    ps -ef|grep nginx

    3、停止

    killall -9 nginx 或者pkill -9 nginx

    4、基本操作命令(前提,需要sbin目录下 

    ./nginx -h #帮助   

    ./nginx -v #显示版本   

    ./nginx -V #显示版本和配置信息  

    ./nginx -t #测试配置   

    ./nginx -q #测试配置时,只输出错误信息   

    ./nginx -s stop #停止服务器   

    ./nginx -s reload #重新加载配置 

    参考于:http://jingyan.baidu.com/article/e2284b2b45f693e2e6118de5.html

                 http://jingyan.baidu.com/article/2fb0ba404f814e00f2ec5f9e.html

  • 相关阅读:
    并发解决方案
    主外键
    ms
    mq消息丢失
    五种IO模型
    程序运行时间计算gettimeofday&clock_gettime
    exec与xargs区别
    mysql修改数据存放路径(linux)
    od用不同的编码输出文件内容
    segfault at f0 ip 00007f9954108feb sp 00007fffb5e64fc0 error 4 in libxxx.so[7f99540df000+54000]
  • 原文地址:https://www.cnblogs.com/fun0623/p/4398876.html
Copyright © 2011-2022 走看看