1、下载源码包解压编译

1、在官网下载使用Xftp上传到linux上(不推荐使用)

2、(推荐)在版本上选好,直接命令下载,如下:(下载nginx-1.16.1.tar.gz版本)建议到home目录执行该命令,方便找到

wget http://nginx.org/download/nginx-1.16.1.tar.gz

已安装好

3、解压

tar xvf nginx-1.16.1.tar.gz -C /usr/local/src/

4、安装相应的开发工具

yum groupinstall "Development tools"yum-y install gcc wget gcc-c++ automake autoconf libtool libxml2-devel libxslt-devel perl-devel perl-ExtUtils-Embed pcre-devel openssl-devel

5、进入nginx目录进行编译安装

1、进入目录

cd /usr/local/src/nginx-1.16.1

2、执行以下命令,直接粘贴即可

./configure \--prefix=/usr/local/nginx \--sbin-path=/usr/sbin/nginx \--conf-path=/etc/nginx/nginx.conf \--error-log-path=/var/log/nginx/error.log \--http-log-path=/var/log/nginx/access.log \--pid-path=/var/run/nginx.pid \--lock-path=/var/run/nginx.lock\--http-client-body-temp-path=/var/tmp/nginx/client \--http-proxy-temp-path=/var/tmp/nginx/proxy \--http-fastcgi-temp-path=/var/tmp/nginx/fcgi \--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \--http-scgi-temp-path=/var/tmp/nginx/scgi \--user=nginx \--group=nginx \--with-pcre \--with-http_v2_module \--with-http_ssl_module \--with-http_realip_module \--with-http_addition_module \--with-http_sub_module \--with-http_dav_module \--with-http_flv_module \--with-http_mp4_module \--with-http_gunzip_module \--with-http_gzip_static_module \--with-http_random_index_module \--with-http_secure_link_module \--with-http_stub_status_module \--with-http_auth_request_module \--with-mail \--with-mail_ssl_module \--with-file-aio \--with-ipv6 \--with-http_v2_module \--with-threads \--with-stream \--with-stream_ssl_module

View Code

3、完成编译安装

make && make install

mkdir -pv /var/tmp/nginx/client

6、添加SysV启动脚本

1、创建文件

vi /etc/init.d/nginx

2.按i进入编辑状态

#!/bin/sh

#

# nginx - this script starts and stops the nginx daemon

#

# chkconfig: - 85 15

# description: Nginx is an HTTP(S) server, HTTP(S) reverse \

# proxy and IMAP/POP3 proxy server

# processname: nginx

# config: /etc/nginx/nginx.conf

# config: /etc/sysconfig/nginx

# pidfile: /var/run/nginx.pid

# Source function library.

. /etc/rc.d/init.d/functions

# Source networking configuration.

. /etc/sysconfig/network

# Check that networking is up.

[ "$NETWORKING" = "no" ] && exit 0

nginx="/usr/sbin/nginx"

prog=$(basename $nginx)

NGINX_CONF_FILE="/etc/nginx/nginx.conf"

[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx

lockfile=/var/lock/subsys/nginx

start() {

[ -x $nginx ] || exit 5

[ -f $NGINX_CONF_FILE ] || exit 6

echo -n $"Starting $prog: "

daemon $nginx -c $NGINX_CONF_FILE

retval=$?

echo

[ $retval -eq 0 ] && touch $lockfile

return $retval

}

stop() {

echo -n $"Stopping $prog: "

killproc $prog -QUIT

retval=$?

echo

[ $retval -eq 0 ] && rm -f $lockfile

return $retval

killall -9 nginx

}

restart() {

configtest || return $?

stop

sleep 1

start

}

reload() {

configtest || return $?

echo -n $"Reloading $prog: "

killproc $nginx -HUP

RETVAL=$?

echo

}

force_reload() {

restart

}

configtest() {

$nginx -t -c $NGINX_CONF_FILE

}

rh_status() {

status $prog

}

rh_status_q() {

rh_status >/dev/null 2>&1

}

case "$1" in

start)

rh_status_q && exit 0

$1

;;

stop)

rh_status_q || exit 0

$1

;;

restart|configtest)

$1

;;

reload)

rh_status_q || exit 7

$1

;;

force-reload)

force_reload

;;

status)

rh_status

;;

condrestart|try-restart)

rh_status_q || exit 0

;;

*)

echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"

exit 2

esac

7.赋予脚本执行权限

chmod +x /etc/init.d/nginx

8.添加nginx服务进程用户

groupadd -r nginx

useradd-r -g nginx nginx

9、添加至服务管理列表,设置开机自启

chkconfig --add nginx

chkconfig nginx on

10、启动nginx

1、先查看端口号

netstat -tnlp

2、启动

service nginx start

3、查看端口号启动成功

linux nginx权限配置文件,linux下nginx部署以及配置详解相关推荐

  1. django配置环境linux,linux环境下Django的安装配置详解

    linux环境下Django的安装配置详解 1. 下载安装Django pip install Django==1.6.5 测试是否安装成功 >>> import django> ...

  2. Linux下的samba服务配置详解

    Linux下的samba服务配置详解 一.Samba介绍 二.Samba工具及特性 三.搭建环境介绍 四.Samba配置步骤 1.服务端操作 2.在客户端操作 五.测试用户的权限情况 一.Samba介 ...

  3. Spring中,applicationContext.xml 配置文件在web.xml中的配置详解

    Spring中,applicationContext.xml 配置文件在web.xml中的配置详解 2016年10月04日 15:22:26 阅读数:7936 转自http://www.cnblogs ...

  4. 1 企业实战(3) Redis服务部署和配置详解 (资源)

    前言: 环境介绍: CentOS 7.5 Redis 5.0.0 gcc 下载: http://download.redis.io/releases/ 安装redis: [root@localhost ...

  5. linux下nginx部署以及配置详解

    1.下载源码包解压编译 启动多个,请看:在linux系统下安装两个nginx以及启动 查看nginx包路径:http://nginx.org/download/,两种下载方式: 1.在官网下载使用Xf ...

  6. linux centos7 mysql_Linux centos7环境下安装MySQL的步骤详解

    Linux centos7环境下安装MySQL的步骤详解 安装MySQL mysql 有两个跟windows不同的地方 1).my.ini 保存到/etc/my.ini 2).用户权限,单独用户执行 ...

  7. Nginx设置成服务并开机自动启动的配置详解

    Nginx 是一个高性能的HTTP和反向代理web服务器,同时也提供了IMAP/POP3/SMTP服务,接下来通过本文给大家介绍Nginx设置成服务并开机自动启动的配置,需要的朋友可以参考下 在/et ...

  8. nginx post请求超时_Nginx 的超时 timeout 配置详解

    本文介绍 Nginx 的 超时(timeout)配置.分享给大家,具体如下: Nginx 处理的每个请求均有相应的超时设置.如果做好这些超时时间的限定,判定超时后资源被释放,用来处理其他的请求,以此提 ...

  9. CentOS6.5下的Nagios安装配置详解(图文)

    最近因为,科研需要,接触上了Nagios,这里,我将安装笔记做个详解.为自己后续需要和博友们学习! VMware workstation 11 的下载 VMWare Workstation 11的安装 ...

最新文章

  1. 加密货币支付卡公司与BCH达成合作
  2. IDEA注释模板,动作要快,姿势要帅!
  3. matlab中服从高斯分布的矩阵_推荐基础算法之矩阵分解PMF
  4. Java核心类库-IO-打印流(PrintStream/PrintWriter)
  5. 浏览器拦截打开新窗口情况总结
  6. tar.gz 文件解压 (安装 netbean 时会用到)
  7. android10全局黑暗,传Android 11或加入自动切换全局黑暗模式功能
  8. logstash-input-redis源码解析
  9. 【Java】编写Java程序,完成从键盘输入两个运算数据,计算两数之和并输出结果...
  10. #华为云·寻找黑马程序员#微服务-你真的懂 Yaml 吗?
  11. tomcat的安装以及配置
  12. windows系统文件和dll文件
  13. 回顾2020年(1)
  14. 如何禁止拼音加加自动修改IE首页
  15. 【Java线程池实现原理及其在美团业务中的实践】
  16. 中文论文检索证明怎么开_论文检索证明在哪里弄
  17. .NET之盛派微信SDK简单操作
  18. ArcGIS10.0专题图制作文档
  19. i9 10900k和i7 9700k的区别大吗
  20. 移动分销平台是什么鬼?

热门文章

  1. java多线程详解 六_java多线程学习-java.util.concurrent详解(六) Exchanger
  2. android 360自动更新,解决Android百度自动更新SDK和360自动更新SDK兼容
  3. java中singleton_Singleton是什么,在Java中如何实现
  4. SpringBoot 1 使用 Dubbo Initializer 快速整合 Dubbo
  5. 文件存储demo,直接存储内容到本地中。
  6. react-native props和state传值
  7. 启动vue项目报错faield at the vue-cli-service serve
  8. mysql数据生产数据分析_基于MySQL玩转SQL数据分析课程 互联网数据分析师-SQL数据分析实战视频教程...
  9. Vue脚手架搭建简单步骤
  10. 2016/1/14 java随机数生成