zoukankan      html  css  js  c++  java
  • ngnix随笔一

    nginx安装及启动

    1.用yum源安装,首先配置yum源 在“/etc/yum.repo.d/”下创建yum源文件

    例如:cd /etc/yum.repo.d/nginx.repo

      [nginx-stable]

    name=nginx stable repo
    baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
    gpgcheck=1
    enabled=1
    gpgkey=https://nginx.org/keys/nginx_signing.key
    module_hotfixes=true

    2.查看yum源包

      yum info nginx 查看nginx安装包源信息版本等

      yum install nginx  安装yum源安装包

      安装完成后用"nginx -h" 查看nginx应用的命令

    [root@192 ~]# nginx -h
    nginx version: nginx/1.16.1
    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: /etc/nginx/)
      -c filename   : set configuration file (default: /etc/nginx/nginx.conf)
      -g directives : set global directives out of configuration file

    3.用"nginx"命令启动nginx服务

       启动服务后用命令ss -ntlp查看端口和服务的情况

    [root@192 ~]# ss -ntlp
    State       Recv-Q Send-Q                                                 Local Address:Port                                                                Peer Address:Port              
    LISTEN      0      128                                                                *:111                                                                            *:*                   users:(("rpcbind",pid=856,fd=8))
    LISTEN      0      128                                                                *:80                                                                             *:*                   users:(("nginx",pid=6044,fd=6),("nginx",pid=6043,fd=6),("nginx",pid=5797,fd=6))
    LISTEN      0      5                                                      192.168.122.1:53                                                                             *:*                   users:(("dnsmasq",pid=1704,fd=6))
    LISTEN      0      128                                                                *:22                                                                             *:*                   users:(("sshd",pid=1236,fd=3))
    LISTEN      0      128                                                        127.0.0.1:631                                                                            *:*                   users:(("cupsd",pid=1233,fd=12))
    LISTEN      0      128                                                        127.0.0.1:6010                                                                           *:*                   users:(("sshd",pid=5517,fd=9))
    LISTEN      0      128                                                               :::111                                                                           :::*                   users:(("rpcbind",pid=856,fd=11))
    LISTEN      0      128                                                               :::22                                                                            :::*                   users:(("sshd",pid=1236,fd=4))
    LISTEN      0      128                                                              ::1:631                                                                           :::*                   users:(("cupsd",pid=1233,fd=11))
    LISTEN      0      128                                                              ::1:6010                                                                          :::*                   users:(("sshd",pid=5517,fd=8))

    4.再开通防火墙和80端口即可

     firewall-cmd --zone=public --add-port=80/tcp --permanent
    firewall-cmd --reload

    5用其他主机访问IP地址即可

  • 相关阅读:
    mysql drop table & myisam
    python 发送 html email
    python mysqldb 查询返回字典结构
    shell 脚本 连接数据库
    python 中使用map 构建sql查询语句
    C#启动一个外部程序(1)WinExec
    知道在那里划这一条线吗[zt]
    C#启动一个外部程序(2)ShellExecute
    把FlashCom 帮助安装到Flash 8 中文版
    C#读写ini文件
  • 原文地址:https://www.cnblogs.com/hekuangquanshuiweiteng/p/12725548.html
Copyright © 2011-2022 走看看