CentOS 5.6 安装Nginx(转)

在/usr目录下执行命令下载最新Nginx源代码:

 

  1. wget http://nginx.org/download/nginx-1.2.0.tar.gz  


解压后可以看到nginx-1.2.0目录:

 

 

  1. tar zxvf nginx-1.2.0.tar.gz  


安装PCRE库

 

 

  1. yum -y install pcre-devel  


安装openssl库

 

 

  1. yum -y install openssl openssl-devel  


生成make file文件:

 

 

  1. ./configure --prefix=/usr/nginx  


结果要仔细看一下,有些很重要的信息:

 

 

  1. creating objs/Makefile  
  2. Configuration summary  
  3.   + using system PCRE library  
  4.   + OpenSSL library is not used  
  5.   + md5: using system crypto library  
  6.   + sha1: using system crypto library  
  7.   + using system zlib library  
  8.   nginx path prefix: "/usr/nginx"  
  9.   nginx binary file: "/usr/nginx/sbin/nginx"  
  10.   nginx configuration prefix: "/usr/nginx/conf"  
  11.   nginx configuration file: "/usr/nginx/conf/nginx.conf"  
  12.   nginx pid file: "/usr/nginx/logs/nginx.pid"  
  13.   nginx error log file: "/usr/nginx/logs/error.log"  
  14.   nginx http access log file: "/usr/nginx/logs/access.log"  
  15.   nginx http client request body temporary files: "client_body_temp"  
  16.   nginx http proxy temporary files: "proxy_temp"  
  17.   nginx http fastcgi temporary files: "fastcgi_temp"  
  18.   nginx http uwsgi temporary files: "uwsgi_temp"  
  19.   nginx http scgi temporary files: "scgi_temp"  


比如pid 文件,error log文件,access log文件等等。

 

现在编译和安装:

 

  1. make   
  2. make install  


进入/usr/nginx/sbin目录下,可以执行nginx程序启动。

 

如果要修改端口,修改/usr/nginx/conf/nginx.conf文件,比如:

 

  1. server {  
  2.        listen       8081;  



 

posted @ 2017-01-04 22:54  BruckD  阅读(52)  评论(0)    收藏  举报