zoukankan      html  css  js  c++  java
  • nginx服务器搭建

    nginx服务搭建
    防火墙,安全机制的关闭
    iptables -F
    systemctl stop firewalld
    setenforce 0
    本地yum的构建
    安装依赖包
    yum -y install pcre-devel zlib-devel openssl-devel
    nginx服务的搭建需要pcre、zlib等软件包的技术支持
    从网上下载nginx软件包
    weget+复制的下载路径,或者下载到桌面rz上传
    tar -xf nginx-1.14.2.tar.gz -C /usr/src/ #把安装包解压到/usr/src/下
    cd /usr/src/nginx-1.14.2
    ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module &&make &&make install
    --prefix 设定Nginx的安装目录
    --user和--group 指定Nginx运行用户和组
    --with-http_stub_status_module 启用http_stub_status_module模块以支持状态统计
    --with-http_ssl_module 启用SSL模块
    --with-http_flv_module 启用FLV模块,提供寻求内存使用基于时间的偏移量文件
    echo $PATH
    ln -s /usr/local/nginx/sbin/nginx /usr/local/bin
    ll /usr/local/bin/nginx
    nginx -t #检查你的语法是否正确 successful ok代表正确
    nginx #启动nginx
    netstat -anpt | grep :80 #80端口nginx使用
    在浏览器中输入你的ip地址测试nginx是否运行
    Welcome to nginx!
    HUP 重载进程 等同于-1 killall -s HUP nginx
    QUIT 退出进程 等同于 -3 killall -s QUIT nginx
    kill杀死进程根据PID号 kill + pid号
    PID号的存放位置
    cat /usr/local/nginx/logs/nginx.pid
    netstat -anpt | greo :80 查看80端口是谁使用着
    netstat -a 显示所有 -t tcp传输协议连接状态 -u udp协议连接状态 -p显示程序名称 -n直接使用IP地址,不通过域名服务器
    为了让服务开机可以自启动,可以通过编写脚本来实现
    vim /etc/init.d/nginx
    #!/bin/bash
    # chkconfig: 2345 99 20
    # description: Nginx Server Control Script
    PROG="/usr/local/nginx/sbin/nginx"
    PIDF="/usr/local/nginx/logs/nginx.pid"

    case "$1" in
    start)
    $PROG
    ;;
    stop)
    kill -s QUIT $(cat $PIDF)
    ;;
    restart)
    $0 stop
    $0 start
    ;;
    reload)
    kill -s HUP $(cat $PIDF)
    ;;
    *)
    echo "Usage: $0 {start|stop|restart|reload}"
    exit 1
    esac
    exit 0
    chomd +x /etc/init.d/nginx #加上可执行权限
    chkconfig --add nginx
    chkconfig nginx on
    chkconfig --list nginx # 查看开启状态信息
    #服务基本搭建完成

     

     

  • 相关阅读:
    1.RabbitMQ简介
    有这样一个需求 element +vue 实现显示的table 的表头添加一个添加图标, 并绑定一个点击事件,我查了好多资料, 终于找到table 表头的一个事件 :render-header 可以实现。
    原生的html js 做的文件上上传
    elment + vue 文件上传
    FastJson对于JSON格式字符串、JSON对象及JavaBean之间的相互转换
    mysql 数据库迁移 sql server (沃尔玛)
    quartz 浅谈 Scheduler
    quartz CronTrigger的cron表达式 详解:
    Linux中的一些常用命令
    类图中常用的六种关系
  • 原文地址:https://www.cnblogs.com/zcdhhh/p/11504304.html
Copyright © 2011-2022 走看看