• nginx入门之安装和启动


    1、安装环境

    nginx 使用源码编译安装,环境及组件如下:

    1. make 环境
    2. openssl-fips-2.0.10
    3. pcre-8.44
    4. zlib-1.2.11
    5. nginx-1.10.2

    需要注意各组件的版本,有些版本会不配套,导致编译失败

    ./configure 或 ./config
    make
    make install
    

    安装完成之后,可以进 /usr/local/nginx 查看目录,目录结构如下:

    conf/	-首页的html文件
    html/	-配置文件
    sbin/	-执行文件
    

    2、启动和关闭

    进入安装目录下,启动nginx

    ./sbin/nginx
    

    查看nginx是否正在运行

    ps -aux | grep nginx
    

    其它相关命令

    ./nginx -s stop
    ./nginx -s quit
    ./nginx -s reload	//刷新配置文件
    

    nginx 默认使用80端口,在浏览器中输入服务器ip,即可访问nginx的主页

    3、常用指令

    nginx -s stop	#关闭
    nginx -s quit	#等待工作进程完成后关闭
    nginx -s reload	#刷新配置文件
    nginx -s reload	#向主进程发送信号,重新加载配置文件,热更新配置
    nginx -s reopen	#重启
    nginx -T		#查看当前nginx的最终配置
    nginx -t -c <配置路径>	#检查配置是否正确,-c后面检查不在配置文件夹下的配置文件
    

    systemctl 是linux 指令,也可以用于 nginx

    systemctl start nginx	#启动
    systemctl stop nginx	#停止
    systemctl restart nginx	#重启
    systemctl reload nginx	#重新加载,用于配置文件修改之后
    systemctl enable nginx	#设置开机启动
    systemctl disable nginx	#关闭开机启动
    systemctl status nginx	#查看运行状态
    
  • 相关阅读:
    Spring 发生 has not been refreshed yet 异常
    rsyslog config
    grok
    阿里云态势
    Unity的asm笔记
    Unity2020或Unity2019安装后无法启动
    rider代码折叠
    使用rider调试lua
    MacType更好的字体渲染
    Unity字体和画面花屏处理
  • 原文地址:https://www.cnblogs.com/sherlock-lin/p/13413492.html
Copyright © 2020-2023  润新知