|
centos7编译安装nginx:
首先确保系统上存在编译安装使用的必要工具运行:
#yumgroupinstall"developmenttools""serverplatformdevelopment" 1 下载PCRE version 4.4 — 8.40 (ngx_http_rewrite_module模块需要)
#wgetftp://ftp.csx.cam.ac.uk/pub/soft ... re/pcre-8.40.tar.gz 2 下载zlib ( ngx_http_gzip_module模块需要)
#wgethttps://zlib.net/zlib-1.2.11.tar.gz 3 下载openssl (http_ssl_module模需要)
#wgethttps://github.com/openssl/openssl/archive/OpenSSL_1_1_0f.tar.gz 3 下载nginx
#wgethttps://nginx.org/download/nginx-1.12.1.tar.gz
正式开工:
1 解压PCRE
#tarxzvfpcre-8.40.tar.gz-C/usr/local/src/ 2 解压zlib
#tarxzfzlib-1.2.11.tar.gz-C/usr/local/src/ 3 解压openssl
#tarxzfOpenSSL_1_1_0f.tar.gz-C/usr/local/src/ 4 安装nginx
添加nginx用户:
#groupaddnginx#useradd-gnginx-s/sbin/nologinnginx 创建nginx日志保存目录
#mkdir/var/log/nginx 解压安装包
#tarxzfnginx-1.12.1.tar.gz#cdnginx-1.12.1#./configure--prefix=/usr/local/nginx\--conf-path=/etc/nginx/nginx.conf\--pid-path=/var/log/nginx/run/nginx.pid\--error-log-path=/var/log/nginx/error.log\--http-log-path=/var/log/nginx/access.log\--user=nginx--group=nginx\--with-select_module\--with-poll_module\--with-http_ssl_module\--with-pcre=/usr/local/src/pcre-8.40\--with-zlib=/usr/local/src/zlib-1.2.11\--with-openssl=/usr/local/src/openssl-OpenSSL_1_1_0f#make&&makeinstall 此时,nginx已经安装完成,可以去/usr/local/nginx/sbin/下,通过运行 ./nginx 命令来启动nginx
5 配置NGINX systemd service (注意:根据自己配置,配置路径信息!)
#vim/lib/systemd/system/nginx.service[Unit]Description=TheNGINXHTTPandreverseproxyserverAfter=syslog.targetnetwork.targetremote-fs.targetnss-lookup.target[Service]Type=forkingPIDFile=/var/log/nginx/run/nginx.pidExecStartPre=/usr/local/nginx/sbin/nginx-tExecStart=/usr/local/nginx/sbin/nginxExecReload=/bin/kill-sHUP$MAINPIDExecStop=/bin/kill-sQUIT$MAINPIDPrivateTmp=true[Install]WantedBy=multi-user.target 此时
启动nginx
#systemctlstartnginx 查看状态
#systemctlstatusnginx 停止nginx
#systemctlstopnginx 6 编译安装的nginx不会做日志分割
#vimlogrotate.sh#!/bin/bashcd/var/log/nginxmvaccess.logaccess.log.$(date+%F)mverror.logerror.log.$(date+%F)kill-USR1$(cat/var/log/nginx/run/nginx.pid)sleep1gzipaccess.log.$(date+%F)gziperror.log.$(date+%F) 通过crontab实现定时日志轮替。
若以上内容,有什么问题,请指正。
谢谢! MPLS VPN的价值在于它可以在无连接网络中引入连接模式的特征。其主要优点是降低网络复杂度,兼容现有各种主流网络技术,降低网络成本,在提供IP服务时保证QoS和安全性,并具有流量工程能力。另外,MPLS可以解决VPN扩容和维护成本的问题。
|
|