centos 源码安装Nginx


下载nginx  并创建用户和组  安装所需要的组件

[root@localhost ~]# wget  http://nginx.org/download/nginx-1.6.2.tar.gz   稳定版
[root@localhost ~]# yum install pcre-devel -y  依赖perl扩展的正则表达式
[root@localhost ~]# groupadd -r -g 110 nginx   添加以个nginx组为系统组
[root@localhost ~]# useradd -r -u 110 -g 110 nginx  添加以个用户为系统用户  专门管理nginx
[root@localhost ~]# yum -y install cmake  gcc gcc-c++  autoconf automake zlib*  libxml* \
ncurses ncurses-devel libtool-ltdl-devel* make  bison bison-devel libaio 
[root@localhost ~]# tar xf nginx-1.6.2.tar.gz                                                                            
[root@localhost ~]# cd nginx-1.6.2                                                                                           
[root@localhost nginx-1.6.2]# ls                                                                                                
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src
[root@localhost nginx-1.6.2]#yum install openssl-devel  gd-devel gd        --库是图片过滤处理模块

开始编译:
第一种 :   ./configure --prefix=/usr/local/nginx
第二种 :
./configure \
  --prefix=/usr \
  --sbin-path=/usr/sbin/nginx \
  --conf-path=/etc/nginx/nginx.conf \
  --error-log-path=/var/log/nginx/error.log \
  --http-log-path=/var/log/nginx/access.log \
  --pid-path=/var/run/nginx/nginx.pid  \
  --lock-path=/var/lock/nginx.lock \
  --user=nginx \
  --group=nginx \
  --with-http_ssl_module \
  --with-http_flv_module \
  --with-http_stub_status_module \
  --with-http_gzip_static_module \
  --http-client-body-temp-path=/var/tmp/nginx/client/ \
  --http-proxy-temp-path=/var/tmp/nginx/proxy/ \
  --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
  --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
  --http-scgi-temp-path=/var/tmp/nginx/scgi \
  --with-pcre \
  --with-file-aio \
  --with-http_image_filter_module

make && make install


[root@localhost nginx-1.6.2]#nginx

检查是否启动成功

[root@localhost ~]# ps -ef |grep nginx
root       1086      1  0 18:12 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx      1088   1086  0 18:12 ?        00:00:00 nginx: worker process                   
root       1142   1124  0 18:21 pts/0    00:00:00 grep nginx
[root@localhost ~]# service iptables stop    #关闭防火墙
[root@localhost ~]# service iptables status  #查看防火墙状态
iptables: Firewall is not running.
[root@localhost ~]# 

最后测试是否成功  IE输入 http://ip


Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

网站的目录
./configure \
  --prefix=/usr \----------------网站的目录 
  --sbin-path=/usr/sbin/nginx \
  --conf-path=/etc/nginx/nginx.conf \
  --error-log-path=/var/log/nginx/error.log \
  --http-log-path=/var/log/nginx/access.log \
  --pid-path=/var/run/nginx/nginx.pid  \
  --lock-path=/var/lock/nginx.lock \
  --user=nginx \
根据安装显示 我们的安装目录在/usr
下面我看看。
[ root@localhost ~]# ls /usr
bin  etc  games  html  include  lib  lib64  libexec  local  sbin  share  src  tmp
其中
html  默认站点的主目录
sbin  存放nginx的程序



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值