跳到正文
当下的七炎
返回

nginx

编辑文章

安装

windows版本 http://nginx-win.ecsds.eu/download/

启动,关闭的命令

PS D:\nginx-1.14.2> taskkill /f /im nginx.exe
成功: 已终止进程 "nginx.exe",其 PID 为 15116。
成功: 已终止进程 "nginx.exe",其 PID 为 16232。
// 测试配置文件
PS D:\nginx-1.14.2> .\nginx -t
nginx: the configuration file D:\nginx-1.14.2/conf/nginx.conf syntax is ok
nginx: configuration file D:\nginx-1.14.2/conf/nginx.conf test is successful
PS D:\nginx-1.14.2> start .\nginx
查看运行端口
netstat -ano
查看进程
tasklist /fi "imagename eq nginx.exe"

nginx配置

// 解决`/product-poimanagement`开头接口跨域的问题
server {
        listen       80;  #nginx监听的端口
        server_name  launchpad1.com;
        location / {
            proxy_pass      http://localhost:8080; #前端项目启动url
	}
        location /product-poimanagement {
		proxy_pass http://launchpad.com; #实际接口的地址
	}
}

注意

listen 的端口和location里面的端口不能一样,否则会出现 错误10060:A connection attempt failed because the

错误处理

logs>error.log 里面有错误信息,复制出来去google搜


编辑文章
分享这篇文章:

评论

使用 GitHub 账号登录后即可评论


上一篇
经济学的十大原理
下一篇
随笔