热门标签 | HotTags
当前位置:  开发笔记 > 后端 > 正文

CentOS编译安装Nginx服务器

在/usr目录下执行命令下载最新Nginx源代码:wgethttp://nginx.org/download/nginx-1.2.0.tar.gz解压后可以看到nginx-1.2.0目录:tarzxvfnginx-1.2.0.tar.gz安装PCRE库yum-yinstallpcre-devel安装openssl库yu
在/usr目录下执行命令下载最新Nginx源代码:
wget http://nginx.org/download/nginx-1.2.0.tar.gz  

解压后可以看到nginx-1.2.0目录:
tar zxvf nginx-1.2.0.tar.gz  

安装PCRE库
yum -y install pcre-devel  

安装openssl库
yum -y install openssl openssl-devel  

生成make file文件:
./configure --prefix=/usr/nginx  

结果要仔细看一下,有些很重要的信息:
creating objs/Makefile  
Configuration summary  
  + using system PCRE library  
  + OpenSSL library is not used  
  + md5: using system crypto library  
  + sha1: using system crypto library  
  + using system zlib library  
  nginx path prefix: "/usr/nginx"  
  nginx binary file: "/usr/nginx/sbin/nginx"  
  nginx configuration prefix: "/usr/nginx/conf"  
  nginx configuration file: "/usr/nginx/conf/nginx.conf"  
  nginx pid file: "/usr/nginx/logs/nginx.pid"  
  nginx error log file: "/usr/nginx/logs/error.log"  
  nginx http access log file: "/usr/nginx/logs/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"  

比如pid 文件,error log文件,access log文件等等。
现在编译和安装:
make   
make install  

进入/usr/nginx/sbin目录下,可以执行nginx程序启动。
如果要修改端口,修改/usr/nginx/conf/nginx.conf文件,比如:
server {  
       listen       8081;  

推荐阅读
author-avatar
傅雪莱_
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有