阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Linux下Nginx服务安装配置

128次阅读
没有评论

共计 3060 个字符,预计需要花费 8 分钟才能阅读完成。

1、Nginx 介绍

Nginx 是一个高性能的 HTTP 和反向代理服务器, 由俄罗斯人开发的,第一个版本发布于 2004 年 10 月 4 日。Nginx 由于出色的性能,在世界范围内受到了越来越多人的关注,其特点是占有内存少,并发能力强,nginx 的并发能力确实在同类型的网页服务器中是很强的,国内 BAT、163、新浪等等都在使用 nginx 进行服务发布和管理。Nginx 还对负载均衡等提供了非常方便的配置,同时 Nginx 众多的插件和功能集成更是让 Nginx 成为某些 WEB 应用场景的不二选择。以上的内容或许稍显夸张,只因为鄙人是 Nginx 的忠实粉丝,见仁见智吧,起码 Nginx 是一种非常好的选择。

Nginx 官网地址:http://nginx.org/

2、Nginx 服务安装

Nginx 提供了对主流 Linux 操作系统的支持,Windwos 下也有相应的版本,但由于操作系统的一些限制,在 Windows 操作系统上部分功能缺失,在性能上也也较大的差距。Nginx 在 windows 上安装配置:http://nginx.org/en/docs/windows.html

Linux 下 Nginx 也提供了标准的 RPM 包,直接安装后配置即可使用,非常方便。但标准包里的组件都是是固定的,对以后组件的扩展等不是很好,而且路径的配置也比较固定。

使用标准包安装地址:

命令如下:rpm -ivh http://nginx.org/packages/CentOS/7/noarch/RPMS/nginx-release-centos-7-0.el6.ngx.noarch.rpm

这里我选择了源码编译安装。安装步骤如下:

1> 安装依赖库

[root@rk /]#yum install gcc-c++
 yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel
[root@rk /]#yum -y install gcc automake autoconf libtool make

2> 创建安装目录,下载安装包

[root@rk /]#mkdir /usr/nginx
[root@rk /]#chmod 777 /usr/nginx
[root@rk /]#cd /usr/nginx
[root@rk nginx]#cd wget http://nginx.org/download/nginx-1.9.4.tar.gz

3> 解压配置

[root@rk nginx]#tar -zxvf nginx-1.9.4.tar.gz
[root@rk nginx]#cd nginx-1.9.4
[root@rk nginx-1.9.4]#./configure --prefix=/usr/webserver/nginx 
--sbin-path=/usr/webserver/nginx 
--conf-path=/usr/webserver/nginx/nginx.conf 
--error-log-path=/home/databak/log/nginx/error.log 
--http-log-path=/home/databak/log/nginx/access.log 
--pid-path=/usr/webserver/nginx/run/nginx.pid 
--lock-path=/usr/webserver/nginx/run/nginx.lock 
--http-client-body-temp-path=/home/databak/cache/nginx/client_temp --http-proxy-temp-path=/home/databak/cache/nginx/proxy_temp 
--http-fastcgi-temp-path=/home/databak/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/home/databak/cache/nginx/uwsgi_temp 
--http-scgi-temp-path=/home/databak/cache/nginx/scgi_temp 
--with-http_image_filter_module 
--with-http_ssl_module 
--with-http_realip_module 
--with-http_addition_module 
--with-http_sub_module 
--with-http_dav_module 
--with-http_flv_module 
--with-http_mp4_module 
--with-http_gunzip_module 
--with-http_gzip_static_module 
--with-http_random_index_module 
--with-http_secure_link_module 
--with-http_stub_status_module 
--with-http_auth_request_module 
--with-mail --with-mail_ssl_module 
--with-file-aio 
--with-http_spdy_module 
--with-ipv6 
--with-threads 
--with-stream 
--with-stream_ssl_module

4> 编译

[root@rk nginx-1.9.4]#make && make install

编译成功后 Nginx 就安装好了。

5> 重启服务

[root@rk nginx]#./nginx -c nginx.conf

  6> 测试

浏览器中输入 Nginx 地址,出现如下画面则安装启动完成

Linux 下 Nginx 服务安装配置

更多 Nginx 相关教程见以下内容

CentOS 6.2 实战部署 Nginx+MySQL+PHP http://www.linuxidc.com/Linux/2013-09/90020.htm

使用 Nginx 搭建 WEB 服务器 http://www.linuxidc.com/Linux/2013-09/89768.htm

搭建基于 Linux6.3+Nginx1.2+PHP5+MySQL5.5 的 Web 服务器全过程 http://www.linuxidc.com/Linux/2013-09/89692.htm

CentOS 6.3 下 Nginx 性能调优 http://www.linuxidc.com/Linux/2013-09/89656.htm

CentOS 6.3 下配置 Nginx 加载 ngx_pagespeed 模块 http://www.linuxidc.com/Linux/2013-09/89657.htm

CentOS 6.4 安装配置 Nginx+Pcre+php-fpm http://www.linuxidc.com/Linux/2013-08/88984.htm

Nginx 安装配置使用详细笔记 http://www.linuxidc.com/Linux/2014-07/104499.htm

Nginx 日志过滤 使用 ngx_log_if 不记录特定日志 http://www.linuxidc.com/Linux/2014-07/104686.htm

Nginx 的详细介绍:请点这里
Nginx 的下载地址:请点这里

本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-03/129423.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计3060字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中