强上阿里云之NGINX安装

  • 来源:
  • 更新日期:2018-05-10

摘要:#创建www用户 [ -z \"`grep www /etc/group`\" ] && useradd www -s /sbin/nologin #安装pcre yum install pcre pcre-devel unzip gd-devel -y #创建软件下载目录 mkdir -p /data/web && mkdir -p /root/software && cd /root/softwa

 

#创建www用户 [ -z "`grep www /etc/group`" ] && useradd www -s /sbin/nologin

002UASMrzy7605pjKJv15&690.jpg

#安装pcre yum install pcre pcre-devel unzip gd-devel -y #创建软件下载目录 mkdir -p /data/web && mkdir -p /root/software && cd /root/software/ #下载软件 if [ ! -f nginx-1.12.0.tar.gz ];then wget -c http://scripts.showshowbaby.com/lnmp/soft/nginx-1.12.0.tar.gz #安装 tar zxvf nginx-1.12.0.tar.gz && cd nginx-1.12.0 ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module make && make install ln -sf /usr/local/nginx/sbin/nginx /usr/bin/nginx rm -rf /usr/local/nginx/logs && mkdir -p /data/wwwlogs/ && chown -R www.www /data/wwwlogs && ln -sf /data/wwwlogs /usr/local/nginx/logs #配置文件 rm -f /usr/local/nginx/conf/{fcgi.conf,mime.types,age-max.conf,nginx.conf} cd /usr/local/nginx/conf/ wget -c http://scripts.showshowbaby.com/lnmp/conf/{fcgi.conf,mime.types,age-max.conf,nginx.conf} mkdir -p /usr/local/nginx/conf/{ssl,vhost} ##下载配置日志切割计划任务 cd /root/sh/ && wget -c http://scripts.showshowbaby.com/lnmp/sh/nginx_cut_log.sh chmod +x nginx_cut_log.sh echo "00 00 * * * root /bin/bash /root/sh/nginx_cut_log.sh >/dev/null 2>&1" >> /etc/crontab ##下载添加虚拟主机脚本 wget -c http://scripts.showshowbaby.com/lnmp/sh/addnginx && mv addnginx /sbin/ && chmod +x /sbin/addnginx ##开机启动 cd /etc/init.d/ && wget -c http://scripts.showshowbaby.com/lnmp/sh/nginx && chmod +x /etc/init.d/nginx chkconfig nginx on #启动 /etc/init.d/nginx start