您现在的位置是:首页 > 文章详情

在Linux环境下的安装Nginx

日期:2018-04-01点击:432

第一步,安装gcc的环境。

[root@nginx home]# yum install gcc-c++

第二步,安装第三方依赖包。

// PCRE(Perl Compatible Regular Expressions)是一个Perl库,包括 perl 兼容的正则表达式库。nginx的http模块使用pcre来解析正则表达式,所以需要在linux上安装pcre库。 [root@nginx home]# yum install -y pcre pcre-devel // zlib库提供了很多种压缩和解压缩的方式,nginx使用zlib对http包的内容进行gzip,所以需要在linux上安装zlib库。 [root@nginx home]# yum install -y zlib zlib-devel // OpenSSL 是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及SSL协议,并提供丰富的应用程序供测试或其它目的使用。 [root@nginx home]# yum install -y openssl openssl-devel
这里使用的是yum安装,也可以下载三方库离线安装 

第三步,解压ngnix安装包。

[root@nginx home]# tar -zxvf nginx-1.8.0.tar.gz 

第四步,使用./configure命令创建makeFile文件,并且配置nginx。

[root@nginx nginx-1.8.0]# cd nginx-1.8.0 [root@nginx nginx-1.8.0]# ./configure \ --prefix=/usr/local/nginx \ --pid-path=/var/run/nginx/nginx.pid \ --lock-path=/var/lock/nginx.lock \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --with-http_gzip_static_module \ --http-client-body-temp-path=/var/temp/nginx/client \ --http-proxy-temp-path=/var/temp/nginx/proxy \ --http-fastcgi-temp-path=/var/temp/nginx/fastcgi \ --http-uwsgi-temp-path=/var/temp/nginx/uwsgi \ --http-scgi-temp-path=/var/temp/nginx/scgi1

第五步,make&&make install

[root@nginx nginx-1.8.0]# make [root@nginx nginx-1.8.0]# make install

第六步,创建临时文件。

[root@nginx home]# mkdir /var/temp/nginx/client -p

第七步,启动nginx。

[root@nginx home]# cd /usr/local/nginx/sbin/ // 启动 [root@nginx sbin]# ./nginx // 关闭 [root@nginx sbin]# ./nginx -s quit // 重启,先关闭后启动 // 动态加载配置文件 [root@nginx sbin]# ./nginx -s reload
原文链接:https://www.centoschina.cn/server/test/nginx/10014.html
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章