nginx安装教程(linux)

安装nginx:

1.正式开始前,编译环境gcc g++ 开发库之类的需要提前装好.

安装make
yum -y install gcc automake autoconf libtool make
安装g++:
yum install gcc gcc-c++

一般我们都需要先装pcre, zlib,前者为了重写rewrite,后者为了gzip压缩。
2.安装PCRE库
cd /data/server
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz 获取tar包
tar -zxvf pcre-8.40.tar.gz
cd pcre-8.40/
./configure && make && make install

3.安装zlib
cd /data/server
wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11/
./configure && make && make install

4.安装openssl
cd /data/server
wget http://www.openssl.org/source/openssl-fips-2.0.10.tar.gz
tar zxvf openssl-fips-2.0.10.tar.gz
 cd openssl-fips-2.0.10
 ./config && make && make install

 注:1-4 步可以用下面命令代理
 yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel
 
 5.安装nginx  
 cd /data/server  
 wget http://nginx.org/download/nginx-1.10.2.tar.gz
 tar -zxvf nginx-1.10.2.tar.gz
cd nginx-1.10.2/
配置命令:
./configure --prefix=/data/server/nginx 
--prefix=/data/server/nginx  nginx的安装目录
执行结果:
nginx path prefix: "/data/server/nginx"
  nginx binary file: "/data/server/nginx/sbin/nginx"
  nginx modules path: "/data/server/nginx/modules"
  nginx configuration prefix: "/data/server/nginx/conf"
  nginx configuration file: "/data/server/nginx/conf/nginx.conf"
  nginx pid file: "/data/server/nginx/logs/nginx.pid"
  nginx error log file: "/data/server/nginx/logs/error.log"
  nginx http access log file: "/data/server/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"
编译安装: 
make && make install 
 

nginx启动:

进入启动目录sbin:cd /data/server/nginx/sbin/

./nginx                      # 启动 Nginx
./nginx -s reload            # 重新载入配置文件
./nginx -s reopen            # 重启 Nginx
./nginx -s stop              # 停止 Nginx

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值