2024年3月20日发(作者:)

文档来源:

目的:搭建Nginx与tomcat整合,用Nginx代替apache

步骤:

一、安装Nginx

1、上传至/usr/local

2、执行如下命令解压nginx:

1.#cd /usr/local

2.#tar zxvf

3、编译安装nginx

1.#cd nginx-0.7.63

2.#./configure --with-http_stub_status_module --with-http_ssl_module #启动server状态页和

https模块

执行完后会提示一个错误,说缺少PCRE library 这个是HTTP Rewrite 模块,也即是url静

态化的包

可上传,输入如下命令安装:

1.#tar zxvf

2.#cd pcre-7.9

3.#./configure

4.#make

5.#make install

安装pcre成功后,继续安装nginx

如果是ubuntu 或Debian系统请先安装

# apt-get install libpcre3 libpcre3-dev

原文:

I need to compile few application and I need Perl 5 Compatible Regular Expression Library

(PCRE). Under CentOS I can use a package called pcre-devel, but Debian do not have the same.

How do I install pcre-devel under Debian / Ubuntu Linux?

Perl-compatible regular expression library. PCRE has its own native API, but a set of "wrapper"

文档来源:

文档来源:

functions that are based on the POSIX API are also supplied in the library libpcreposix. Note that

this just provides a POSIX calling interface to PCRE: the regular expressions themselves still

follow Perl syntax and semantics. The header file for the POSIX-style functions is called

pcreposix.h. To install PCRE, type thy following command:

# apt-get update

# apt-get install libpcre3 libpcre3-dev

1.#cd nginx-0.7.63

2.#./configure

3.#make

4.#make install

4、nginx安装成功后的安装目录为/usr/local/nginx

在conf文件夹中新建,用于配置一些代理参数,内容如下:

01.#!nginx (-)

02.#

_redirect off;

_set_header Host $host;

_set_header X-Real-IP $remote_addr; #获取真实ip

06.#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #获取代理者的真

实ip

_max_body_size 10m;

_body_buffer_size 128k;

_connect_timeout 90;

_send_timeout 90;

_read_timeout 90;

_buffer_size 4k;

_buffers 4 32k;

_busy_buffers_size 64k;

_temp_file_write_size 64k;

编辑安装目录下conf文件夹中的,输入如下内容

001.#运行nginx所在的用户名和用户组

002.#user www www;

003.

004.#启动进程数

_processes 8;

006.#全局错误日志及PID文件

文档来源: