Centos 安装 nginx openssl (仅环境,供新手参考)

步骤一、首先确认托管商是否在系统中安装gcc,输入命令gcc -v ,显示如下跳过步骤二

[root@MyCloudServer /]# gcc -v 
Using built-in specs.
Target: i686-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)


步骤二、安装gcc和gcc-c++

yum -y install gcc

yum -y install gcc-c++


步骤三、安装pcre-devel(在Nginx编译需要 PCRE(Perl Compatible Regular Expression),因为Nginx 的Rewrite模块和HTTP 核心模块会使用到PCRE正则表达式语法

yum -y install pcre-devel


步骤四、安装openssl和openssl-devel 

yum  -y install openssl 
yum  -y install openssl-devel


步骤五、下载nginx

wget http://nginx.org/download/nginx-1.3.11.tar.gz /opt/


步骤六、安装nginx

# tar -zxvf nginx-1.3.11.tar.gz
# cd nginx-1.3.11
# ./configure --prefix=/opt/nginx --with-http_stub_status_module --with-http_ssl_module 
# make
# make install
其他编译参数说明
--prefix=/usr 
--sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--pid-path=/var/run/nginx/nginx.pid
--lock-path=/var/lock/nginx.lock
--user=www-nginx
--group=www
--with-http_flv_module
--with-http_gzip_static_module
--http-log-path=/var/log/nginx/access.log --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/
--with-http_stub_status_module #nginx状态
--with-http_ssl_module #支持HTTPS
--with-http_sub_module #支持URL重定向
--with-pcre=/usr/include/pcre/ (启用正规表达式)
--with-md5=/usr/lib #md5是一种加密算法
--with-http_memcached_module (启用memcache缓存) 
--with-http_rewrite_module (启用支持url重写)
--with-ipv6 (支持ipv6)


步骤七、为nginx指定编译后的配置文件

sbin/nginx -c /opt/nginx/conf/nginx.conf


步骤八、启动nginx

sbin/nginx -s reload

转载于:https://my.oschina.net/wangdaxin/blog/347148

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值