sunny123456

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  1796 随笔 :: 22 文章 :: 24 评论 :: 226万 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

CentOS7.0下编译安装Nginx

  写在前面的话

  每次在Linux搭建web环境都要一顿google求参考文档,这次索性写个简单的文章记录一下。其实Linux下编译安装主要就是这几个步骤。

  安装编译工具、依赖包及下载源码包

  解压编译

  安装

  启动

  准备工作安装编译工具、依赖包

$ yum -y install gcc gcc-c++ autoconf automake $ yum -y install zlib zlib-devel openssl openssl-devel pcre-devel

  以上安装的是一些主要的依赖包,www.lu0.com具体可根据自己情况或者报错信息提示安装或修改

  新建匿名用户和用户组

  新建的用户组和用户主要是在编译配置的时候指定nginx运行的用户和用户组。这样指定后以后配置使用也方便。

  

$ sudo groupadd -r nginx $ sudo useradd -s /sbin/nologin -g nginx -r nginx
Nginx编译安装下载源码包

  我一般从官网下载

  

wget 
解压并编译
解压
tar -zxvf nginx-1.10.0.tar.gz
配置

  配置没毛病的话可以看到这些信息

  

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 modules path: /usr/local/nginx/modules nginx configuration prefix: /etc/nginx nginx configuration file: /etc/nginx/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

  以上编译参数只是配置了主要的东西,全部配置参数说明你可以通过这个命令查看
./configure --help

  

编译并安装

  $ make make install
启动等命令
须进入到/usr/local/nginx/sbin目录下

  

启动:
$ nginx
停止:
$ nginx -s stop
重启:
$ nginx -s reload

  以上各个步骤报错的话根据报错提示缺啥装啥,不犯几次错误都不好意思说自己配过环境。PS:有问题可留言讨论哦

  


  博客原文链接

https://www.lu0.com/news/content/15065.html
posted on   sunny123456  阅读(44)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2019-10-11 C# MVC文件上传注意点
2019-10-11 C# MVC文件上传
2019-10-11 博客园怎么转载别人的文章
2019-10-11 MVC 控制器向View传值的三种方法(转) C#
点击右上角即可分享
微信分享提示