• nginx的安装


    1. epol源安装

    [root@web01 ~]# yum install -y nginx
    
    [root@web01 ~]# rpm -qa  nginx
    nginx-1.16.1-1.el7.x86_64
    
    

    2.官方源安装

    1)配置官方源

    [nginx-stable]
    name=nginx stable repo
    baseurl=http://nginx.org/packages/centos/7/$basearch/    #修改为自己的centos版本
    gpgcheck=1
    enabled=1
    gpgkey=https://nginx.org/keys/nginx_signing.key
    module_hotfixes=true
    
    

    2)安装nginx

    [root@web02 ~]# yum install -y nginx
    
    [root@web02 ~]# rpm -qa nginx
    nginx-1.18.0-1.el7.ngx.x86_64
    
    

    3.启动nginx服务

    [root@web02 ~]# systemctl start nginx
    #或者
    [root@web02 ~]# nginx
    
    

    4.检验启动

    #方式一:
    	[root@web02 ~]# ps -ef | grep nginx
    #方式二:
    	[root@web02 ~]# netstat -lntp | grep 80
    #方式三:
    	访问页面 10.0.0.8:80
    #方式四:
        #查看版本
        [root@web02 ~]# nginx -v
        #查看安装模块
        [root@web02 ~]# nginx -V
        
    

    5.nginx常用命令

    1.启动命令
    [root@web02 ~]# systemctl start nginx
    #或者
    [root@web02 ~]# nginx
    
    #注意,使用哪种方式启动就用哪种方式关闭
    2.关闭命令
    [root@web02 ~]# systemctl stop nginx
    #或者
    [root@web02 ~]# nginx -s stop
    
    3.nginx重启
    [root@web02 ~]# systemctl restart nginx
    
    4.nginx重载配置文件
    [root@web02 ~]# systemctl reload nginx
    #或者
    [root@web02 ~]# nginx -s reload
    
    5.检查nginx配置
    [root@web01 ~]# nginx -t
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    
    6.加入开机自启
    [root@web01 ~]# systemctl enable nginx
    Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
    
    7.CentOS6操作
    #启动
    [root@web01 ~]# nginx
    [root@web01 ~]# /etc/init.d/nginx start
    [root@web01 ~]# service nginx start
    
    #配置开机自启
    [root@web01 ~]# chkconfig nginx on
    
    
  • 相关阅读:
    Mybatis学习笔记14
    Mybatis学习笔记13
    Mybatis学习笔记12
    poj 2513
    poj 2001
    poj 1080
    poj 1703
    poj 1521
    poj 1384
    poj 1726
  • 原文地址:https://www.cnblogs.com/backz/p/15328988.html
Copyright © 2020-2023  润新知