免安装版nginx启动代理服务全程分解

故事背景:当我们要排查线上问题,必须上流水线构建部署,或者不能直接接触服务器及部署资源,且本地无法复现线上的状况时,可以模拟建立一个本地的线上环境,用来验证复现

一、下载免安装nginx压缩包

http://nginx.org/en/download.html

二、博主选1.18.0

在这里插入图片描述

三、解压缩后

在这里插入图片描述

四、修改conf目录下的nginx.conf(根据自己的情况来)

我修改后的配置:

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    #tcp_nopush     on;

    proxy_connect_timeout 600;
    proxy_read_timeout 600;
    proxy_send_timeout 600;
    keepalive_timeout 600;
    client_header_timeout 600;
    client_body_timeout 600;
    reset_timedout_connection on;
    send_timeout 600;

    #gzip  on;

   server {
        listen 8088;
        server_name localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }

        location /actionDimension/report/ {
          proxy_pass http://33.7.105.34:8080/report/;
        }
        location /customerManageDimension/report/ {
          proxy_pass http://33.7.105.34:8080/report/;
        }
        location /messageSendDimension/report/ {
          proxy_pass http://33.7.105.34:8080/report/;
        }
        location /moonBulletinDimension/report/ {
          proxy_pass http://33.7.105.34:8080/report/;
        }
    }
}
五、将前端打包后的dist目录里所有文件拷贝到html目录下
六、command+R打开window的运行窗口,并输入PowerShell打开命令窗口
七、cd到nginx的解压缩根目录
八、输入./nginx运行Nginx服务(也可以运行./nginx -s reload重启服务)
九、nginx运行报错conf unknown directive " "解决方案

这是编码问题,需要用记事本另存为ANSI编码

附上其他链接:

redis官网:https://redis.io/

windows版本免安装redis下载链接:https://github.com/MSOpenTech/redis/releases

nginx官网:http://nginx.org/

windows版本免安装redis下载链接:http://nginx.org/en/download.html

注意:

如果直接双击nginx.exe,会导致修改配置后重启、停止nginx无效,需要手动关闭任务管理器内的所有nginx进程

nginx.exe目录,打开命令行工具,用命令启动/关闭/重启nginx

如果没有设置环境变量,执行命令需要加路径./(根据自己的目录和cmd目录来确定),如果设置了PATH就可以省略

  • 启动:start ./nginx
  • 重新加载配置:./nginx -s reload
  • 重新打开日志文件:./nginx -s reopen
  • 测试nginx配置文件是否正确:./nginx -t -c conf/nginx.conf
  • 关闭nginx: ./nginx -s stop(快速停止nginx) ./nginx -s quit(有序停止nginx)
  • zookeeper官网:http://zookeeper.apache.org/
  • windows版本免安装zookeeper下载链接:http://mirrors.shu.edu.cn/apache/zookeeper/stable/
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hzxOnlineOk

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值