一、下载免安装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- 启动: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/



