首页 技术 正文
技术 2022年11月12日
0 收藏 961 点赞 3,478 浏览 2276 个字

#安装pcreyum install -y pcre-devel#安装zlib-develyum install -y zlib-devel#下载nginxwget -r -np -nd http://nginx.org/download/nginx-1.13.0.tar.gz#解压nginxtar zxvf nginx-1.13.0.tar.gz#配置nginx,需进入nginx目录./configure#安装nginxmakemake install#nginx默认安装在/usr/local/nginx#此时需要配置nginx 的配置文件/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf设置开机启动:#创建文件vi /etc/init.d/nginx#输入以下内容#!/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 0nginx=”/usr/local/nginx/sbin/nginx”prog=$(basename $nginx)NGINX_CONF_FILE=”/usr/local/nginx/conf/nginx.conf”[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginxlockfile=/var/lock/subsys/nginxmake_dirs() {# make required directoriesuser=`$nginx -V 2>&1 | grep “configure arguments:.*–user=” | sed ‘s/[^*]*–user=\([^ ]*\).*/\1/g’ -`if [ -n “$user” ]; thenif [ -z “`grep $user /etc/passwd`” ]; thenuseradd -M -s /bin/nologin $userfioptions=`$nginx -V 2>&1 | grep ‘configure arguments:’`for opt in $options; doif [ `echo $opt | grep ‘.*-temp-path’` ]; thenvalue=`echo $opt | cut -d “=” -f 2`if [ ! -d “$value” ]; then# echo “creating” $valuemkdir -p $value && chown -R $user $valuefifidonefi}start() {[ -x $nginx ] || exit 5[ -f $NGINX_CONF_FILE ] || exit 6make_dirsecho -n $”Starting $prog: “daemon $nginx -c $NGINX_CONF_FILEretval=$?echo[ $retval -eq 0 ] && touch $lockfilereturn $retval}stop() {echo -n $”Stopping $prog: “killproc $prog -QUITretval=$?echo[ $retval -eq 0 ] && rm -f $lockfilereturn $retval}restart() {configtest || return $?stopsleep 1start}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” instart)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 2esac #授权chmod a+x /etc/init.d/nginx#开机启动chkconfig nginx on  

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,987
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,503
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,347
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,130
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,765
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,842