nginx搭建

首先我们需要搭建一些扩展

sudo -s
LANG=C
yum -y install gcc automake autoconf libtool make
yum install gcc gcc-c++
yum -y install libmcrypt-devel mhash-devel libxslt-devel \
libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel \
zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel \
ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel \
krb5 krb5-devel libidn libidn-devel openssl openssl-devel pcre pcre-devel

一、首先安装pcre扩展

1.下载pcre

wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz

2.安装pcre

#tar -zxvf pcre-8.33.tar.gz

#cd pcre-8.33

#./configure

#make

#make install

二、下载nginx

1.下载包

wget http://nginx.org/download/nginx-1.9.5.tar.gz

2.解压,安装

#tar -zxvf nginx-1.9.5.tar.gz

#cd nginx-1.9.5

#./configure --user=nginx\

--group=nginx\

--prefix=/usr/local/nginx \

--with-http_stub_status_module \  #启用 nginx 的 NginxStatus 功能,用来监控 Nginx 的当前状态

--with-http_ssl_module \

--with-pcre=../pcre-8.33  #指向解压的源码目录

#make && make install

三、

配置用户操作nginx日志
groupadd nginx
useradd -g nginx
nginx
mkdir -p /var/log/nginx
chmod +w /var/log/nginx
chown -R nginx:nginx /var/log/nginx


四、

不停止nginx的服务,平滑变更nginx配置
(1)首先检查nginx的配置是否正确
/usr/local/nginx/sbin/nginx.conf -t
如果出现,配置成功
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successfull
(2)平滑重启
/usr/local/nginx/sbin/nginx -s reload

遇到的问题

1.系统中没有安装C语言

yum install gcc来解决问题

2.nginx启动报错

将nginx.conf中的user default;注释去掉

或者创建一个www的用户组和www的用户

#/usr/sbin/groupadd -f www
#/usr/sbin/useradd -g www www


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值