linux 安装 nginx

自用的,不喜勿喷。自己安装成功了。内容有摘自网络。

1、安装必备工具:

$ yum -y install gcc gcc-c++ autoconf automake

$ yum -y install zlib zlib-devel openssl openssl-devel pcre-devel
说明:
pcre: 用来作地址重写的功能。

zlib:nginx 的gzip模块,传输数据打包,省流量(但消耗资源)。

openssl:提供ssl加密协议。
二、Nginx编译安装:

1、下载Nginx:http://nginx.org/en/download.html
安装目录一般都放在:/usr/local/nginx下

2、解压编译:
$ tar -zxvf nginx-1.9.2.tar.gz/

$ mv nginx-1.9.2 nginx

$ cd /usr/local/nginx

$./configure –prefix=/usr/local/nginx //预编译

3、安装:
$ make && make install
第一次安装出现问题:
conf/koi-win' and/usr/local/nginx/conf/koi-win’ are the same file
然后就重新安装一遍 在预编译的时候用命令
./configure –prefix=/usr/local/nginx
改为
./configure –prefix=/usr/local/nginx –conf-path=/usr/local/nginx/nginx.conf
成功安装了。

4、启动:
确保系统的 80 端口没被其他程序占用,
$ nginx -c /etc/nginx/nginx.conf

检查是否启动成功:
netstat -ano|grep 80 有结果输入说明启动成功

打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值