您的位置:首页 > 运维架构 > Nginx

nginx编译安装

2016-03-21 22:04 633 查看
linux 源码安装nginx http://www.cnblogs.com/zhoulf/archive/2013/02/09/2909653.html
安装说明

系统环境:CentOS 6.4 

软件:nginx-1.9.12.tar.gz

安装方式:源码编译安装 

安装位置:/opt/nginx 

下载地址:http://nginx.org/en/download.html

1.yum 安装一些依赖包

[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++

2.创建目录  创建用户  

[root@niaoyun-101 tools]# mkdir   -p  /opt/nginx

[root@niaoyun-101 tools]# mkdir   -p  /opt/tools

[root@niaoyun-101 tools]# groupadd  www

[root@niaoyun-101 tools]# useradd  -g www www

3.编译

[root@niaoyun-101 tools]#wget  http://nginx.org/download/nginx-1.9.12.tar.gz

[root@niaoyun-101 tools]#tar zxf  nginx-1.9.12.tar.gz

[root@niaoyun-101 tools]#cd  nginx-1.9.12

[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

[root@niaoyun-101 nginx-1.9.12]# make

[root@niaoyun-101 nginx-1.9.12]# make  install

[root@niaoyun-101 nginx-1.9.12]# /opt/nginx/sbin/nginx -V

4.修改配置文件

cd   /opt/nginx/conf/

vi  nginx.conf

mkdir    /opt/nginx/conf/vhosts

cd   /opt/nginx/conf/vhosts

vi  80port.conf

5.启动 

[root@niaoyun-101 nginx-1.9.12]# /opt/nginx/sbin/nginx 

[root@niaoyun-101 tools]# ps  -ef |  grep  nginx

root      26050      1  0 18:16 ?        00:00:00 nginx: master process /opt/nginx/sbin/nginx

www       26161  26050  0 18:28 ?        00:00:00 nginx: worker process

root      26225  18824  0 18:35 pts/0    00:00:00 grep nginx

[root@niaoyun-101 tools]# lsof  -i:80
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux 服务器