龙空技术网

CentOS安装nginx

自在冰淇淋6N5 244

前言:

此时兄弟们对“windowsnginx64位”都比较关切,兄弟们都想要剖析一些“windowsnginx64位”的相关文章。那么小编在网摘上网罗了一些对于“windowsnginx64位””的相关文章,希望我们能喜欢,同学们快快来了解一下吧!

阿里云ecs centos7.4 64位;nginx-1.14.0

1、安装gcc,用来编译下载下来的nginx源码

[root@localhost /]# yum install gcc-c++

2、安装pcre和pcre-devel

PCRE(Perl Compatible Regular Expressions) 是一个Perl库,包括 perl 兼容的正则表达式库。nginx 的 http 模块使用 pcre 来解析正则表达式,pcre-devel 是使用 pcre 开发的一个二次开发库。

[root@localhost /]# yum install -y pcre pcre-devel

3、安装zlib,提供了很多压缩和解方式,nginx需要zlib对http进行gzip

[root@localhost /]# yum install -y zlib zlib-devel

4、安装openssl,一个安全套接字层密码库,nginx要支持https,需要使用openssl

[root@localhost /]# yum install -y openssl openssl-devel

5、下载nginx

[root@localhost /]# cd /usr/local

[root@localhost local]# wget

6、解压nginx

[root@localhost local]# tar -zxvf nginx-1.14.0.tar.gz

7、编绎,设置安装路径为:/usr/local/nginx

[root@localhost local]# cd nginx-1.14.0/

[root@localhost nginx-1.14.0]# ./configure --prefix=/usr/local/nginx

8、安装

[root@localhost nginx-1.14.0]# make && make install

9、启动

[root@localhost nginx-1.14.0]# /usr/local/nginx/sbin/nginx

10、重启

[root@localhost nginx-1.14.0]#/usr/local/nginx/sbin/nginx –s reload

11、停止

[root@localhost nginx-1.14.0]#/usr/local/nginx/sbin/nginx –s stop

12、测试配置文件是否正常:

[root@localhost nginx-1.14.0]#/usr/local/nginx/sbin/nginx –t

13、强制关闭

[root@localhost nginx-1.14.0]#pkill nginx

注:若访问ip出现无法访问,则需要到阿里云控制台中设置安全组规则:登陆阿里云账号,进入控制台-》云服务器ECS-》安全组-》配置规则 点击添加安全组规则按照已有示例添加一组规则,开放80端口即可。如下:

添加安全组规则

标签: #windowsnginx64位