center os 7 安装nginx

安装配置nginx

1、下载安装包nginx1.10.3

1.2---解压到/usr/local

1.3---进入目录 执行./configure

# ./configure,

报错:

 

出现这个错误,是因为gcc包没有安装

# yum -y install gcc

# whereis gcc

 

安装gcc之后,运行./configure,

报错:

./configure: error: the HTTP rewrite module requires the PCRE library.

You can either disable the module by using --without-http_rewrite_module

option, or install the PCRE library into the system, or build the PCRE library

statically from the source with nginx by using --with-pcre=<path> option.

 

安装pcre-devle 解决问题 

# yum -y install pcre-devel  

(这里我顺便安装了openssl  # yum -y install pcre-devel openssl openssl-devel )

执行 ./configure

 

如果报错:

...Require the zlib library

...

则执行安装

# yum install zlib-devel -y

 

1.4 -- opensslsha1

如果你想使用openssl功能 sha1功能 那么需要安装opensslsha1

# yum install openssl openssl-devel

开启ssl模块 :

# ./configure --with-http_ssl_module

 

 

启用”server_status”页

# ./configure --with-http_stub_status_module

 

上述两条命令同时启用 可以使用如下命令:

# ./configure --with-http_stub_status_module --with-http_ssl_modile

 

1.5--##编译 安装

上面configure就通过了

执行make make install 命令 ##编译 安装

# make   

# make install

至此,nginx执行成功了。

 

1.6--配置环境变量

# whereis nginx

nginx:/usr/local/nginx

 

/etc/profile 中加入配置

# vim /etc/profile

在配置文件中加入:

#nginx configure

export NGINX_HOME=/usr/local/nginx

export PATH=$PATH:$NGINX_HOME/sbin

编译完保存退出

 

# source /etc/profile

使配置生效 

整个过程,就安装成功了

 

修改nginx,conf

2.1 启动nginx

# cd /usr/local/nginx

# nginx -c conf/nginx.conf

启动成功后,将在浏览器打开 ip加端口号  默认端口号是80

用浏览器打开看到带有welcome to nginx 的页面

 

转载于:https://www.cnblogs.com/hanyingjun/p/9023713.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值