Debian 安装tomcat

Debian 安装nginx

Summer Flower posted @ 2011年5月10日 14:08 in linux , 1352 阅读

1. 下载最新版本的nginx包,我下载的是1.0.1版本。

http://www.nginx.org/en/download.html

2. 解压

tar zxvf nginx-1.0.1.tar.gz 

3. 进入解压后的nginx目录中

# cd nginx-1.0.1 // 进入程序目录
# apt-get install build-essential  // 安装编译环境
# apt-get install libpcre3-dev  // 安装PCRE库
# apt-get install libssl-dev   // 安装Openssl库

4. 准备工作完成以后,就可以开始安装了

a) 编译:

# ./configure --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --http-log-path=/var/log/nginx/access.log --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-http_flv_module

如果编译最后出现类似下面的信息,表示编译已经成功:

Configuration summary
  + using system PCRE library
  + using system OpenSSL library
  + md5: using OpenSSL library
  + sha1 library is not used
  + using system zlib library

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx configuration prefix: "/etc/nginx"
  nginx configuration file: "/etc/nginx/nginx.conf"
  nginx pid file: "/var/run/nginx.pid"
  nginx error log file: "/var/log/nginx/error.log"
  nginx http access log file: "/var/log/nginx/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"

b) 安装

# make
# make install

5. 如果需要更新nginx版本,先按上述1~5的步骤安装好新的nginx,然后运行如下命令进行平滑升级

 

# kill -USR2 `/var/run/nginx.pid`
# kill -QUIT `/var/run/nginx.pid.oldbin`

6. 安全起见,需要隐藏nginx的版本号,方法如下:

1)修改nginx.conf配置:

# vi /etc/nginx/nginx.conf

在http {—}里加上server_tokens off;

2)重新加载配置:

# service nginx reload

 


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter