nginx安装(包括报错)

来源:互联网 发布:无间道 知乎 编辑:程序博客网 时间:2024/06/07 09:14

nginx安装教程:

环境:

  1. VMware Workstation Pro 
  2. CentOS linux系统
  3. nginx-1.3.16.tar.gz 压缩包(linux版)
安装步骤:

  1. 上传nginx压缩包
  2. 解压压缩包
    1. tar -zxvf nginx-1.3.16.tar.gz
  3. 安装
    1. ./configure
  4.  报错 因为 nginx是由c写的 服务器上没有c的编译器  需要安装c
    1. yum -y install gcc-c++ autoconf automake
  5. 继续从新安装
    1. ./configure
  6. 报错 ./configure: error: the HTTP rewrite module requires the PCRE library  缺少 PCRE library 库
    1. yum -y install pcre pcre-devel
  7. 继续从新安装
    1. ./configure
  8. 继续报错 ./configure: error: the HTTP gzip module requires the zlib library. 缺少 zlib 库
    1. yum -y install zlib zlib-devel
  9. 继续从新安装 
    1. ./configure
  10. 安装完成 
  11. make
  12. make install
  13. 查看是否安装好nginx 
    1. 在 usr/Local 下出现nginx文件夹即可
  14. 进入nginx目录如下
conf配置文件文件夹html网页文件logs日志文件sbinnginx应用程序
nginx常用命令:
启动
./nginx(普通启动)
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/spongeli.conf(加载配置文件启动)
关闭
ps -ef|grep nginx(查看线程)      kill -9 nginx(杀掉线程)
./nginx -s stop(关闭nginx服务)
重启./nginx -s reload