• 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地址即可

  • 相关阅读:
    工作
    失败
    理想和一些未来的计划
    安静
    重新开始
    如何度过周末
    放假
    WPF学习笔记-数据采集与监控项目01-登录界面
    VS2017-断点感叹号问题,调试代码显示“当前无法命中断点,还没有为该文档加载任何符号”
    WPF-MVVM模式-表现层的UI框架【学习笔记】
  • 原文地址:https://www.cnblogs.com/hekuangquanshuiweiteng/p/12725548.html
Copyright © 2020-2023  润新知