Centos7源码安装nginx

阅读数:147 评论数:0

跳转到新版页面

分类

Linux

正文

1、下载安装包

yum install gcc-c++

2. gcc安装

yum install gcc-c++

3. pcre安装

perl compatible reqular expressions是一个perl库,nginx的http模块使用pcre来解析正则表达式

yum install -y pcre pcre-devel

4. zlib安装

nginx使用zlib对http包的内容进行gzip

yum install -y zlib zlib-devel

5. openssl安装

nginx支持的https使用openssl库

yum install -y openssl openssl-devel

6. 使用非root用户解压并配置

如果需要负载tcp  --with-stream

如果需要ssl, --with-http_ssl_module

如果需要支持静态gzip压缩方式(提前将需要压缩的文件压缩好,当客服请求到达时,直接发送压缩好的.gz文件),--with-http_gzip_static_module

tar -zxvf nginx-1.10.1.tar.gz
cd nginx-1.10.1
1.使用默认配置
 
./configure 
 --prefix=/home/yourname/nginx/
 
2.自定义配置(不推荐)
 
./configure \
--prefix=/usr/local/nginx \
--conf-path=/usr/local/nginx/conf/nginx.conf \
--pid-path=/usr/local/nginx/conf/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi

7. make && make install

8.启动、停止nginx

cd /usr/local/nginx/sbin/
./nginx 
./nginx -s stop
./nginx -s quit
./nginx -s reload
./nginx -t 测试配置文件是否正确
./nginx -s quit:此方式停止步骤是待nginx进程处理任务完毕进行停止。
./nginx -s stop:此方式相当于先查出nginx进程id再使用kill命令强制杀掉进程。

9、nginx使用1024以下的端口

1024以内的端口:
setcap cap_net_bind_service=+eip /nginx_home/sbin/nginx



相关推荐

一、概述 yum是yellow dog updater,modified的简称,是rpm软件包管理器,用python写成,可以安装、移除、升级rpm包,检查并自动解决依赖性。 yum使用的软件仓库除了

# download source code from http://www.mplayerhq.hu/design7/dload.html & extract wget -cS http://www

一、概述 1、locale中语言环境变量LANG 在Linux中通过locale来设置程序运行的不同语言环境,locale由ANSI C提供支持。locale的命名规则为<语言>_<地区>.<字符集编

一、概述 Centos7 默认使用的是firewall作为防墙。 1.firewalld (防火墙服务) #启动: systemctl start firewalld #关闭: systemctl

[root@VM_167_46_centos etc]# free -h total used free shared buff/cache available Mem: 993M 253M 334

1. 进入目录 cd /etc/sysconfig/network-scripts/ <p

对于 CentOS 7,有 KDE Plasma Workspaces 和 Gnome Desktop 两大桌面环境。 要安装 KDE 桌面环境(使用的是 Plasma 作为默认的

1、安装依赖 # 卸载低版本 yum remove git yum install -y zlib-devel cu

1、下载chrome.rpm包后,执行 wget https://dl.google.com/linux/direc

1、安装相关软件 yum install bridge-utils yum install epel-relea