ngnix配置
来源:互联网 发布:苹果微信数据损坏失败 编辑:程序博客网 时间:2024/05/18 00:39
现在的项目开发,大多数都是前后端分离的,所以难免会遇到跨域的问题,这时候就需要使用ngnix来转发
首先,配置文件结构如下:
主要我们需要配置的地方是server,server里面的listen是需要监听的端口,location 配置的是url的路径,比如:
location /{
root F:/LinkCM_WorkSpace/opp-gjyjb-web/;
index index.html index.htm;
}
而proxy_pass是转发到的地址,如下:
location /dss-opp-base/ {
proxy_pass http://localhost:8080;
proxy_connect_timeout 50s;
#proxy_read_timeout 20s;
}
意思是,当你以/结尾的url请求时,回去root路径下找名称为index的文件
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
server {
listen 5008;
server_name localhost;
location / {
root F:/LinkCM_WorkSpace/base-opp-web/;
index index.html index.htm;
}
location /dss-opp-base/ {
proxy_pass http://localhost:8080;
proxy_connect_timeout 50s;
#proxy_read_timeout 20s;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 5009;
server_name localhost;
location / {
root F:/LinkCM_WorkSpace/opp-gjyjb-web/;
index index.html index.htm;
}
location /opp-gjyjb/ {
proxy_pass http://localhost:8080;
proxy_connect_timeout 50s;
#proxy_read_timeout 20s;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 5010;
server_name localhost;
location / {
root F:/LinkCM_WorkSpace/base-opp-web-springmvc/;
index index.html index.htm;
}
location /opp-server/ {
proxy_pass http://localhost:8090;
proxy_connect_timeout 50s;
#proxy_read_timeout 20s;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
不喜勿喷,只是记录一下自己的心得。
- ngnix 配置
- ngnix配置
- Ngnix配置
- ngnix配置
- Ngnix安装与配置
- ngnix 防盗链配置
- ngnix反向代理配置
- ngnix-fastcgi通用配置
- Ngnix 安装及配置
- ngnix配置及实战
- ngnix 配置错误页面
- tomcat 与 ngnix配置
- ngnix负载均衡配置
- 【工具和配置】Ngnix配置
- 【工具和配置】Ngnix配置
- linux+ngnix+php 安装配置
- ngnix for python+django 配置
- ngnix静态资源访问配置
- python小技巧
- python错误处理记录完整的异常堆栈信息
- STm32驱动74HC595引脚图时序图工作原理
- Mybatis传入多个参数和${}与#{}的区别
- 蓝桥杯斐波拉切数列踩过的坑
- ngnix配置
- javascript定义个json对象
- 借工业物联网融合IT与OT 驱动制造服务化转型
- 在express 模板引擎的路由中加载socket.io
- 【Cocos2d-x游戏开发lua篇之基础】加载图片与设置按钮监听事件
- java的变量和常量以及常量池
- Web services快速入门
- Springmvc在限制只能在一处登陆
- 删除指定数据项后的级联删除注意事项