Nginx学习笔记——安装起步

本文档详细介绍了如何安装Nginx,包括推荐的稳定版本选择,依赖库如pcre的安装,以及从源码安装的步骤。在生产环境中,建议使用稳定版Nginx以确保系统的可靠性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

该文档所用的nginx版本

2016-01-26 nginx-1.8.1 stable and nginx-1.9.10 mainline versions

发音

nginx发音是engine x

版本

nginx的下载页面(http://nginx.org/en/download.html)上会同时给出最新的Mainline versionStable versionLegacy versions,分别对应开发版、稳定版和历史版本。在生产环境建议使用稳定版本。

安装

安装依赖库

nginx依赖gccopenssl-develpcrezlib-devel,其中pcre不在系统光盘中,需要单独安装。
pcre是为了使nginx支持HTTP Rewrite模块。全称是Perl Compatible Regular Expressions。

  • pcre的版本说明

PCRE库有两个主要版本,最新版本PCRE2,2015年发布了10.21版本;被广泛部署的PCRE原始版本,最初于1997年发布,现在的版本是8.38,API和特性都已经稳定,将来的版本发布只会修复bug。

安装nginx

官方文档给出的从源码安装的步骤如下:

./configure
make
sudo make install

默认情况下,nginx 会被安装到/usr/local/nginx目录。
安装程序打印的提示信息如下:

[gap@localhost nginx-1.8.0]$ sudo ./configure 

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/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx configuration prefix: "/usr/local/nginx/conf"
  //配置文件
  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"  
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  //错误日志
  nginx error log file: "/usr/local/nginx/logs/error.log"  
  //访问日志
  nginx http access log file: "/usr/local/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"

安装完成后,查看nginx版本信息。

[gap@localhost nginx]$ sbin/nginx -v
nginx version: nginx/1.8.0
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值