Nginx安装启动

  1. 安装必备插件
    yum -y install gcc automake autoconf libtool make
    yum install gcc gcc-c++
  2. yum方式安装opensslpcrezlib

    yum -y install openssl openssl-devel
    yum -y install pcre pcre-devel
    yum -y install zlib zlib-devel 
  3. 下载安装Nginx(安装目录在/usr/local/nginx,安装ssl模块)
    wget http://nginx.org/download/nginx-1.15.0.tar.gz
    tar -zxvf nginx-1.15.0.tar.gz
    cd nginx-1.15.0
    ./configure --sbin-path=/usr/local/nginx/nginx --with-http_ssl_module
    make && make install
  4. Nginx安全证书生成
    openssl genrsa -out privkey.pem 1024/2038
    openssl req -new -x509 -key privkey.pem -out server.pem -days 365
  5. 启动服务
    cd /usr/local/nginx
    启动服务
    ./nginx
    重新加载
    ./nginx -s reload
    检查服务
    ./nginx -t
    停止服务
    ./nginx -s stop 
  6. 测试本地是否启动成功,返回带有Welcome to nginx!    的代码即表示启动成功
    curl http://192.168.241.129/
  7. 关闭防火墙,禁止自启动
    service iptables stop
    chkconfig iptables off

     

posted @ 2019-09-14 10:59  华格瑞沙  阅读(303)  评论(0编辑  收藏  举报