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

    1.  下载 http://nginx.org/download/nginx-1.9.9.tar.gz

    2. 在ubuntu19.04机器上安装

      

    install nginx

    http://nginx.org/en/linux_packages.html#Debian

    Install the prerequisites:

    sudo apt install curl gnupg2 ca-certificates lsb-release
    To set up the apt repository for stable nginx packages, run the following command:

    echo "deb http://nginx.org/packages/ubuntu `lsb_release -cs` nginx"
    | sudo tee /etc/apt/sources.list.d/nginx.list
    If you would like to use mainline nginx packages, run the following command instead:

    echo "deb http://nginx.org/packages/mainline/ubuntu `lsb_release -cs` nginx"
    | sudo tee /etc/apt/sources.list.d/nginx.list
    Next, import an official nginx signing key so apt could verify the packages authenticity:

    curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
    Verify that you now have the proper key:

    sudo apt-key fingerprint ABF5BD827BD9BF62
    The output should contain the full fingerprint 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62 as follows:

    pub rsa2048 2011-08-19 [SC] [expires: 2024-06-14]
    573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62
    uid [ unknown] nginx signing key <signing-key@nginx.com>
    To install nginx, run the following commands:

    sudo apt update
    sudo apt install nginx


    配置文件目录: /etc/nginx

    3. 启停nginx服务

    http://nginx.org/en/docs/beginners_guide.html

    sudo nginx

    fast stop:
    sudo nginx -s quit

    graceful shutdown:
    sudo nginx -s stop

    =======================
    stop — fast shutdown
    quit — graceful shutdown
    reload — reloading the configuration file
    reopen — reopening the log files
    =========================
    kill -s QUIT 1628
    ps -ax | grep nginx


    4. 修改配置,搭建静态服务

    sudo vim /etc/nginx/conf.d/default.conf

    在server 中加入:
    location /images/ {
    root /data;
    }

    注意缩进.
    创建目录/data/images , sudo chown pascal:pascal /data/images

    重新加载配置:
    sudo nginx -s reload

    copy image:
    在/data/images加入图片 4662203.jpg

    访问图片:
    http://localhost/images/4392112.jpg


  • 相关阅读:
    Python 如何隐藏属性
    Python 多态
    Python 绑定方法与非绑定方法
    Python 类的组合
    ASP.NET CS文件中输出JavaScript脚本的3种方法以及区别
    JQuery中$之选择器用法介绍
    C#语言之“string格式的日期时间字符串转为DateTime类型”的方法
    .net中response.redirect sever.execute server.transfer 三种页面跳转的方法
    safari,chrome中的window.history.go(-1) history.back()
    onbeforeunload与onunload事件
  • 原文地址:https://www.cnblogs.com/pascal1000/p/13093151.html
Copyright © 2011-2022 走看看