nginx编译安装

来源:互联网 发布:手机服装进销存软件 编辑:程序博客网 时间:2024/05/29 03:22
linux 源码安装nginx
http://www.cnblogs.com/zhoulf/archive/2013/02/09/2909653.html

  1. 安装说明
  2. 系统环境:CentOS 6.4 
  3. 软件:nginx-1.9.12.tar.gz
  4. 安装方式:源码编译安装 
  5. 安装位置:/opt/nginx 
  6. 下载地址:http://nginx.org/en/download.html


  7. 1.yum 安装一些依赖包
  8. [root@niaoyun-101 tools]# yum install  pcre*  zlib*    gcc     openssl  openssl-devel  libxml*  libxslt*   gd-devel  GeoI GeoIP-data GeoIP-devel  perl-devel perl-ExtUtils-Embed  gcc-c++

  9. 2.创建目录  创建用户  
  10. [root@niaoyun-101 tools]# mkdir   -p  /opt/nginx
  11. [root@niaoyun-101 tools]# mkdir   -p  /opt/tools
  12. [root@niaoyun-101 tools]# groupadd  www
  13. [root@niaoyun-101 tools]# useradd  -g www www



  14. 3.编译
  15. [root@niaoyun-101 tools]#wget  http://nginx.org/download/nginx-1.9.12.tar.gz
  16. [root@niaoyun-101 tools]#tar zxf  nginx-1.9.12.tar.gz
  17. [root@niaoyun-101 tools]#cd  nginx-1.9.12
  18. [root@niaoyun-101 nginx-1.9.12]#  ./configure  --prefix=/opt/nginx   --user=www --group=www   --with-http_stub_status_module  --with-select_module --with-poll_module --with-file-aio --with-ipv6   --with-http_ssl_module  --with-http_realip_module   --with-http_addition_module  --with-http_xslt_module   --with-http_image_filter_module  --with-http_geoip_module    --with-http_sub_module  --with-http_dav_module  --with-http_flv_module --with-http_gzip_static_module --with-http_random_index_module   --with-http_secure_link_module  --with-http_degradation_module  --with-http_perl_module   --with-threads
  19. [root@niaoyun-101 nginx-1.9.12]# make
  20. [root@niaoyun-101 nginx-1.9.12]# make  install
  21. [root@niaoyun-101 nginx-1.9.12]# /opt/nginx/sbin/nginx -V

  22. 4.修改配置文件
  23. cd   /opt/nginx/conf/
  24. vi  nginx.conf

  25. mkdir    /opt/nginx/conf/vhosts
  26. cd   /opt/nginx/conf/vhosts
  27. vi  80port.conf


  28. 5.启动 
  29. [root@niaoyun-101 nginx-1.9.12]# /opt/nginx/sbin/nginx 
  30. [root@niaoyun-101 tools]# ps  -ef |  grep  nginx
  31. root      26050      1  0 18:16 ?        00:00:00 nginx: master process /opt/nginx/sbin/nginx
  32. www       26161  26050  0 18:28 ?        00:00:00 nginx: worker process
  33. root      26225  18824  0 18:35 pts/0    00:00:00 grep nginx
  34. [root@niaoyun-101 tools]# lsof  -i:80
0 0
原创粉丝点击