---
title: "linux下安装nginx"
author: "gary0416"
date: "2011-06-26T17:42:02Z"
tags: []
categories: ["操作系统"]
slug: "linux-nginx"
draft: false
lastmod: "2011-06-26T17:42:02Z"
id: 1105505
url: "https://gary0416.iteye.com/blog/1105505"
---

1.下载

nginx

[http://nginx.org/download/nginx-1.0.4.tar.gz](http://nginx.org/download/nginx-1.0.4.tar.gz)

Perl Compatible Regular Expressions(用来rewrite,否则会提示error: the HTTP rewrite module requires the PCRE library.)

 

[ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.12.tar.gz](ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.12.tar.gz%20)

 

 

2.解压缩

tar -zxvf pcre-8.12.tar.gz

tar -zxvf nginx-1.0.4.tar.gz

 

3.进入pcre-8.12目录后

./configure    

make

make install

 

4.进入nginx-1.0.4目录后

运行

./configure --prefix=/usr/local/nginx --with-http\_stub\_status\_module

make

make install

 

搞定...

 

启动nginx

 /usr/local/nginx/sbin/nginx

停止nginx

killall -QUIT nginx

重启nginx

killall -HUP nginx

测试配置文件

/usr/local/nginx/sbin/nginx -t

可看到如下输出

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful