zoukankan      html  css  js  c++  java
  • 部署nginx-上传下载文件

    本节以安装“nginx-1.9.3”为例讲解Nginx的安装方法,请确认已获取nginx-1.9.3相关的安装包。

    步骤 1 root用户登录服务器。

    步骤 2 通过SSHXFTP等工具将以下安装包:

    nginx-1.9.3.tar.gz

    ngx_cache_purge-2.3.tar.gz

    openssl-1.0.2d.tar.gz

    pcre-8.37.tar.gz

    zlib-1.2.8.tar.gz

    上传到Linux服务器的“/tmp”目录下。

    步骤 3 创建nginx目录

    mkdir /opt/nginx

    步骤 4 安装文件拷贝到/opt/nginx 目录

    cp nginx-1.9.3.tar.gz /opt/nginx/

    cp ngx_cache_purge-2.3.tar.gz /opt/nginx/

    cp openssl-1.0.2d.tar.gz /opt/nginx/

    cp pcre-8.37.tar.gz /opt/nginx/

    cp zlib-1.2.8.tar.gz /opt/nginx/

    步骤 5 进入“/opt/nginx”目录。

    cd/usr/local/nginx

     

    步骤 6 安装PCRE

    cd /opt/nginx

    tar -zxvf pcre-8.37.tar.gz 

    cd pcre-8.37 

    ./configure && make && make install

     

    步骤 7 安装zlib

    cd /opt/nginx

    tar -zxvf zlib-1.2.8.tar.gz

    cd zlib-1.2.8 

    ./configure && make && make install

     

    步骤 8 安装ssl

    cd /opt/nginx

    tar -zxvf openssl-1.0.2d.tar.gz

     

    步骤 9 安装ngx_cache_purge模块

    cd /opt/nginx

    tar -zxvf ngx_cache_purge-2.3.tar.gz

     

    步骤 10 安装nginx

    cd /opt/nginx

    tar -zxvf nginx-1.9.3.tar.gz 

    mv nginx-1.9.3 nginx

    cd nginx

    ./configure --sbin-path=/opt/nginx/nginx  --conf-path=/opt/nginx/nginx.conf  --pid-path=/opt/nginx/nginx.pid --with-http_ssl_module  --with-pcre=/opt/nginx/pcre-8.37  --with-zlib=/opt/nginx/zlib-1.2.8  --with-openssl=/opt/nginx/openssl-1.0.2d  --add-module=/opt/nginx/ngx_cache_purge-2.3

    make

    make install

     

    1.1.1 配置Nginx

    步骤 1 修改端口为8989

    vi /opt/nginx/nginx.conf

    listen8989;

    server_name  125.210.111.111;

    IP地址为安装服务器的IP地址

    步骤 2  修改最大并发链接数

    vi /opt/nginx/nginx.conf

    events {

        worker_connections  1000;

    }

    注:1000为系统定义的最大并发连接数

    步骤 3 修改下载目录

    vi /opt/nginx/nginx.conf

    location / {

         root   /down/app;

         index  index.html index.htm;

     }

    注:/down/app为分发文件保存路径

    1.1.2 启动Nginx

    步骤 1 启动nginx/opt/nginx/nginx 目录下,执行以下命令:

    ./nginx

    1.1.3 停止Nginx

    步骤 1 启动nginx/opt/nginx/nginx 目录下,执行以下命令:

    ./nginx –s stop

    1.1.4 重启Nginx

    步骤 1 启动nginx/opt/nginx/nginx 目录下,执行以下命令:

    ./nginx –s reload

     

    备注:分发文件就会分发到 配置的文件夹下,下载就ip:端口号/路径

  • 相关阅读:
    hdu 1003 dp最大子序列和
    模拟题 (+queue队列知识)
    hdu 1016 DFS
    OSGi 系列(二)之 Hello World
    OSGi 系列(一)之什么是 OSGi :Java 语言的动态模块系统
    Mina 系列(四)之KeepAliveFilter -- 心跳检测
    Mina 系列(三)之自定义编解码器.md
    Mina 系列(二)之基础
    Mina 快速入门
    Java 8 Optional 类深度解析
  • 原文地址:https://www.cnblogs.com/onroad2019/p/11326983.html
Copyright © 2011-2022 走看看