1、必要软件准备

  • 安装pcre

为了支持rewrite功能,我们需要安装pcre

 
1
# yum install pcre* //如过你已经装了,请跳过这一步
  • 安装openssl

需要ssl的支持,如果不需要ssl支持,请跳过这一步

 
1
# yum install openssl*

2、安装nginx

执行如下命令:

 
1
2
3
# ./configure --prefix=/usr/local/nginx-1.5.1 \
--with-http_ssl_module --with-http_spdy_module \
--with-http_stub_status_module --with-pcre

--with-http_stub_status_module:支持nginx状态查询
--with-http_ssl_module:支持https
--with-http_spdy_module:支持google的spdy,想了解请百度spdy,这个必须有ssl的支持
--with-pcre:为了支持rewrite重写功能,必须制定pcre

最后输出如下内容,表示configure OK了。
.....

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
checking for zlib library ... found
creating objs/Makefile
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5: using OpenSSL library
+ sha1: using OpenSSL library
+ using system zlib library
nginx path prefix: "/usr/local/nginx-1.5.1"
nginx binary file: "/usr/local/nginx-1.5.1/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx-1.5.1/conf"
nginx configuration file: "/usr/local/nginx-1.5.1/conf/nginx.conf"
nginx pid file: "/usr/local/nginx-1.5.1/logs/nginx.pid"
nginx error log file: "/usr/local/nginx-1.5.1/logs/error.log"
nginx http access log file: "/usr/local/nginx-1.5.1/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
# make //确定你的服务器有安装make,如果没有安装请执行yum install make
# make install

3、启动、关闭、重置nginx

启动:直接执行以下命令,nginx就启动了,不需要改任何配置文件,nginx配置多域名虚拟主机请参考后续文章.

 
1
/usr/local/nginx-1.5.1/sbin/nginx

试试访问:我这边不贴图,直接使用curl命令来读取web信息

 
1
2
[root@ns conf]# curl -s http://localhost | grep nginx.com
nginx.com.

关闭:

 
1
/usr/local/nginx-1.5.1/sbin/nginx -s stop

重置:当你有修改配置文件的时候,只需要reload以下即可

 
1
/usr/local/nginx-1.5.1/sbin/nginx -s reload

整个nginx的安装就到这里结束了。

转载请注明出处:http://www.ttlsa.com/html/1548.html

nginx安装(1) – ttlsa教程系列之nginx的更多相关文章

  1. Nginx 安装与配置教程

    标签: Nginx Linux Windows 配置 描述: Ubuntu 下以及 Windows 下 Nginx 的配置:配置详解:有关 Nginx 如何配置 Nginx 在 Ubuntu 下的安装 ...

  2. Nginx安装、默认虚拟主机、Nginx用户认证和域名重定向

    6月7日任务 12.6 Nginx安装12.7 默认虚拟主机12.8 Nginx用户认证12.9 Nginx域名重定向 扩展nginx.conf 配置详解 http://www.ha97.com/51 ...

  3. Linux centosVMware Nginx安装、 默认虚拟主机、Nginx用户认证、Nginx域名重定向

    一. Nginx安装 cd /usr/local/src wget http://nginx.org/download/nginx-1.12.1.tar.gz 版本在http://nginx.org/ ...

  4. nginx安装最简单教程

    [root@bogon ~]# wget -c http://nginx.org/download/nginx-1.7.9.tar.gz #下载安装包 [root@bogon ~]# ls anaco ...

  5. nginx 安装php

    1. 安装PHP 5.5.0 下载   1 2 cd /usr/local/src/ wget http://www.php.net/get/php-5.5.0.tar.bz2/from/jp1.ph ...

  6. nginx 安装教程

    Nginx 安装教程 本教程在CentOS6.7中安装nginx 1.8.0,Nginx中加入了taobao的concat模块,nginx-upload-module模块,pcre 以及nginx-u ...

  7. 苹果下如果安装nginx,给nginx安装markdown第三方插件

    用brew install nginx 这样安装的是最新版的nginx, 但是在有些情况下,安装第三方插件需要特定的版本,更高一级的版本可能装不上. 它的原理是下载安装包进行自动安装,建立软链,这样就 ...

  8. ubuntu server nginx 安装与配置

    ubuntu server nginx 安装与配置 一:关于nginx http://wiki.ubuntu.org.cn/Nginx http://nginx.org/cn http://wiki. ...

  9. Nginx使用教程(一):Nginx编译参数详解

    从源代码编译应用程序时通常有三个步骤:配置,编译和安装. 配置步骤允许您选择一些在程序编译后无法编辑的选项,因为它对程序二进制文件有直接影响. 因此,这是一个非常重要的阶段,你需要仔细选择,如果你想避 ...

随机推荐

  1. SQL Server With 递归 日期 循环

    要实现的效果:查询从Date From 到 To 之间的 所有日期: 示例代码如下: DECLARE @DATE_FROM DATETIME = N'2016-05-16';--N'2015-05-1 ...

  2. Stanford机器学习笔记-2.Logistic Regression

    Content: 2 Logistic Regression. 2.1 Classification. 2.2 Hypothesis representation. 2.2.1 Interpretin ...

  3. Stanford coursera Andrew Ng 机器学习课程编程作业(Exercise 1)

    Exercise 1:Linear Regression---实现一个线性回归 在本次练习中,需要实现一个单变量的线性回归.假设有一组历史数据<城市人口,开店利润>,现需要预测在哪个城市中 ...

  4. HDU2929 Bigger is Better[DP 打印方案 !]

    Bigger is Better Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others ...

  5. 常见sql数据类型

    数值型类型 INT 从-231到-231-1的整型数据,存储大小2个字节 SMALLLINT 从-32768到32767的整数数据,存储大小4个字节 TINYINT 0~255的整数类型,存储大小1个 ...

  6. 编辑器插件数据保存之Serializable

    Editor数据保存需求 做编辑器插件开发时,当打开一个窗口,对数值进行修改后,在关闭窗口或重新打开Unity时,希望能保存上次的数据. 相关知识 Serialization ,ScriptableO ...

  7. UWP数据绑定

    [ 已针对 Windows 10 上的 UWP 应用更新. 有关 Windows 8.x 文章,请参阅存档 ] 数据绑定是你的应用 UI 用来显示数据的一种方法,可以选择与该数据保持同步. 借助数据绑 ...

  8. [No000030]程序员节发点别的:中国教育整个把人脑子搞坏了-易中天

    导读 在易中天看来,中国教育和中国文化的问题一样,是弱智化.搞坏的原因是什么?是我们的教育评价目标就是"成王败寇"四个字.他明确提出反对励志,反对培优,反对成功学,反对望子成龙.他 ...

  9. 2015-2016-2 《Java程序设计》 游戏化

    2015-2016-2 <Java程序设计> 游戏化 实践「<程序设计教学法--以Java程序设计为例>」中的「游戏化(Gamification)理论」,根据 2015-201 ...

  10. 判断 JS 中对象的类型

    1.typeof 形如 var x = "xx"; typeof x == 'string' typeof(x) 返回类型有:'undefined' “string” 'numbe ...