nginx 配置实战

1. 下载Nginx: http://nginx.org/en/download.html
这里我们下载最新的稳定版:nginx-0.8.54.tar.gz

2. 下载PCRE(Perl Compatible Regular Expressions)包:
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
这里我们下载最新版:pcre-8.11.tar.gz

3. 以root用户登录Linux系统,执行如下命令:
一,先安装pcre 包
1) # tar zxvf pcre-8.11.tar.gz
2) # ./configure
3) # cd pcre-8.11/
4) # make
5) # make  install
二, 安装nginx 包
1) # tar nginx-0.8.54..tar.gz 
2) # cd nginx-0.8.54/
3) # mkdir -p /usr/local/lib/.libs/
# cp /usr/local/lib/libpcre.a /usr/local/lib/.libs/libpcre.a

4) # ./configure --prefix=/opt/nginx \
      --with-pcre=/usr/local/lib \
   --with-http_stub_status_module \
   --with-http_addition_module \
   --with-http_realip_module \
   --with-http_flv_module \
   --with-debug
      --without-http-cache

/opt/nginx:就是程序的安装目录
5) 修改/objs//Makefile 文件
注释掉以下内容: ./configure --disable-shared (位于1100多行)
6) # make
7) # make  install
三, 启动nginx
1) # /opt/nginx/sbin/nginx
安装成功后 /opt/nginx 目录下有四个子目录分别是:conf、html、logs、sbin 。其中 Nginx 的配置文件存放于 conf/nginx.conf,Nginx 只有一个程序文件位于 sbin 目录下的 nginx 文件。确保系统的 80 端口没被其他程序占用
启动后,打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功。

你可能感兴趣的:(nginx,linux,浏览器,cache,perl)