zoukankan      html  css  js  c++  java
  • Linux安装Nginx

    CentOS 通过yum指令安装nginx

    1.创建nginx安装来源

    vi  /etc/yum.repos.d/nginx.repo
    [nginx]
    name=nginx repo
    baseurl=http://nginx.org/packages/centos/7/x86_64/
    gpgcheck=0
    enabled=1

      将$releasever替换为7,将$basearch替换成x86_64,这两个指令可以自动获取系统属性。

    rpm -qa | grep centos-release

    2.安装

    yum install nginx

    3.启动

    service nginx start

    4.本地测试是否启动服务

    curl -i localhost

    Ubuntu 通过apt-get安装Nginx

    1.卸载默认安装

    sudo apt-get remove nginx

    2.安装

    sudo apt-get install software-properties-common
    sudo add-apt-repository ppa:nginx/stable 
    sudo apt-get update
    sudo apt-get install nginx

    3.启动

    1 service nginx start
    2 whereis nginx
    /usr/sbin/nginx start

    4.本地测试是否启动服务

    curl -i localhost

    Nginx常用指令:

    Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]
    
    Options:
      -?,-h         : this help
      -v            : show version and exit
      -V            : show version and configure options then exit
      -t            : test configuration and exit
      -T            : test configuration, dump it and exit
      -q            : suppress non-error messages during configuration testing
      -s signal     : send signal to a master process: stop, quit, reopen, reload
      -p prefix     : set prefix path (default: /usr/share/nginx/)
      -c filename   : set configuration file (default: /etc/nginx/nginx.conf)
      -g directives : set global directives out of configuration file
  • 相关阅读:
    GAMIT中遇到的错误
    bash: ./install_software: Permission denied
    xmanager无法加载远程桌面
    GMT的安装
    小总结:Gamit中常见常用命令
    动态分配指针数组(以解决)
    Gamit使用gftp软件下载数据
    Python基础(1)
    JAVA中关于多线程的理解
    JAVA 基本绘图——利用JFrame JPanel 绘制扇形
  • 原文地址:https://www.cnblogs.com/i-tao/p/9103484.html
Copyright © 2011-2022 走看看