nginx 安装过程

参考:
https://nginx.org/en/download.html

# pwd
/home/soft
# yum install wget
#  yum install pcre
#  yum install openssl*
# yum -y install gcc gcc-c++ autoconf 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 openldap openldap-devel nss_ldap openldap-clients openldap-servers make
# yum -y install gd gd2 gd-devel gd2-devel  

安装 pcre , nginx 需要正则的使用 ,这个建意指定目录安装 /usr/local 
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
# tar -zxvf pcre2-10.21
# cd pcre2-10.21
# ./configure --prefix=/usr/local/pcre2
# make && make install

#  ./configure --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/pcre2 --with-http_realip_module --with-http_image_filter_module

出现错误  
make[1]: *** [/usr/local/pcre842/Makefile] Error 127
解决方案: 
在 nginx  --with-pcre= /usr/local/pcre2 指向参数,是设置源码目录,而不是编译安装后的目录


#  ./configure --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-pcre=/home/soft/pcre2-10.31 --with-http_realip_module --with-http_image_filter_module

出现错误
s -I src/os/unix -I /home/soft/pcre2-10.31 -I objs \
        -o objs/src/core/nginx.o \
        src/core/nginx.c
In file included from src/core/ngx_core.h:71,
                from src/core/nginx.c:9:
src/core/ngx_regex.h:15:18: error: pcre.h: No such file or directory
In file included from src/core/ngx_core.h:71,
                from src/core/nginx.c:9:
src/core/ngx_regex.h:24: error: expected specifier-qualifier-list before ?.cre?
make[1]: *** [objs/src/core/nginx.o] Error 1
make[1]: Leaving directory `/home/soft/nginx-1.12.2'
make: *** [build] Error 2
解决方案:
# yum install pcre-devel

不通过最终还是换回了  pcre-8.42 版本 

# make 
# make install

配置开机启动,在 rc.local 文件后面加上启动路径
vim /etc/rc.local
# for nginx auto start 
/usr/local/nginx/sbin/nginx

制做启动服务脚本 , 先查看 nginx 1.5 版
官方  https://www.nginx.com/resources/wiki/start/topics/examples/redhatnginxinit/
























评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值