Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

centos7.4 安装 nginx1.14 #11

Open
solocao opened this issue Jul 30, 2018 · 0 comments
Open

centos7.4 安装 nginx1.14 #11

solocao opened this issue Jul 30, 2018 · 0 comments

Comments

@solocao
Copy link
Owner

solocao commented Jul 30, 2018

centos7.4 安装 nginx1.14

安装所需环境

1、gcc 安装,编译依赖 gcc 环境。

yum install gcc-c++

2、pcre、pcre-devel 安装 。
PCRE(Perl Compatible Regular Expressions) 是一个Perl库,包括 perl 兼容的正则表达式库。nginx 的 http 模块使用 pcre 来解析正则表达式,所以需要在 linux 上安装 pcre 库,pcre-devel 是使用 pcre 开发的一个二次开发库。

yum install -y pcre pcre-devel

3、zlib 安装 。
zlib 库提供了很多种压缩和解压缩的方式, nginx 使用 zlib 对 http 包的内容进行 gzip ,所以需要在 Centos 上安装 zlib 库

 yum install -y zlib zlib-devel

4、OpenSSL 安装
OpenSSL 是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及 SSL 协议,并提供丰富的应用程序供测试或其它目的使用。
nginx 不仅支持 http 协议,还支持 https(即在ssl协议上传输http),所以需要在 Centos 安装 OpenSSL 库

yum install -y openssl openssl-devel

安装nginx

1、下载nginx源码包

wget -c https://nginx.org/download/nginx-1.14.0.tar.gz

2、解压缩源码包并进入

tar -zxvf nginx-1.14.0.tar.gz
cd nginx-1.14.0

3、配置

推荐使用默认配置

./configure

4、编译并且安装

make && make install

5、 查找安装路径

whereis nginx

常用操作

进入目录

cd /usr/local/nginx/sbin/

1、启动 nginx

./nginx

2、停止 nginx

./nginx -s stop 

3、从容停止 nginx

./nginx -s quit 

4、重启nginx

./nginx -s reload

5、推荐先停止再启动

./nginx -s quit   
./nginx  

6、修改了 nginx 的配置文件 nginx.conf 想让它立即生效时 这时我们就需要重启nginx

./nginx -s reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant