nginx配置前端代理
#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;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80; 监听端口,默认80, 视情况而定
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
location /api/login/ { 根据前端代理配置
proxy_pass http: //a.b.c.d:7080/;
}
location /api/app/ { 根据前端代理配置
proxy_pass http: //a.b.c.d:7080/;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
nginx配置前端代理的更多相关文章
- Windos环境用Nginx配置反向代理和负载均衡
Windos环境用Nginx配置反向代理和负载均衡 引言:在前后端分离架构下,难免会遇到跨域问题.目前的解决方案大致有JSONP,反向代理,CORS这三种方式.JSONP兼容性良好,最大的缺点是只支持 ...
- Linux - Nginx配置反向代理。
Nginx配置反向代理. 准备两台服务器 http://192.168.70.66 http://192.168.70.62 设置正则匹配(192.168.70.66) vim /usr/local/ ...
- CentOS 7 安装 Nginx 配置反向代理
Linux使用Nginx Yum存储库上安装Nginx,适用于Red Hat Enterprise Linux和CentOS系统. 1.添加设置Nginx Yum存储库 在CentOS中首次安装Ngi ...
- [笔记]nginx配置反向代理和负载均衡
1.nginx配置文件:源码安装情况下,nginx.conf在解压后的安装包内.yum安装,一般情况下,一部分在/etc/nginx/nginx.conf中,一部分在/etc/nginx/conf.d ...
- nginx 配置方向代理出错 The character [_] is never valid in a domain name
nginx 配置方向代理出错 The character [_] is never valid in a domain name 下面是配置信息: 原因是使用的tomcat为8及以上的版本时upstr ...
- nginx配置反向代理或跳转出现400问题处理记录
午休完上班后,同事说测试站点访问接口出现400 Bad Request Request Header Or Cookie Too Large提示,心想还好是测试服务器出现问题,影响不大,不过也赶紧上 ...
- nginx笔记 安装nginx 配置 反向代理 多虚拟主机
1,检测linux上是否 通过yum安装了nginxrpm -qi nginx 2.安装nginx之前的依赖包yum install gcc patch libffi-devel python- ...
- nginx配置反向代理详细教程(windows版)
内容属于原创,如果需要转载,还请注明地址:http://www.cnblogs.com/j-star/p/8785334.html Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(I ...
- nginx 配置反向代理
之前的前端是8123端口,使用此端口让nginx的反向代理. vim /etc/nginx/conf.d/80-fr.conf upstream cats{ server 127.0.0.1:8123 ...
随机推荐
- robotframework导入测试库使用方法
1.新建一个测试库 course_mgr.py,存在一个函数listCourse 2.新建RF测试用例使用listCourse关键字 导入测试库如下方式 course_mgr若存在上级目录,则需要加上 ...
- spring cloud--zuul网关和zuul请求过滤
这里仍然以Windows和jdk为运行环境,按照下面的步骤打包-运行-访问就能看到效果.启动项目jar包: java -jar F:\jars-zuul\register-0.0.1-SNAPSHOT ...
- Week_10 C
拓扑排序 Week_10 C 题意:输入n行数据a,b ,表示a的钱数大于b的钱数,最低的人分的的钱数为888,问最少需要多少钱可以分给员工 思路:标准的拓扑排序,不过这题需要逆向拓扑 注意点 ...
- BFS 模拟队列(水题)
BFS 这道题 觉得比较适合BFS新手入门写,也许大家都以为最入门 的BFS题是在二维图上搜索,但是这道题是线性搜索,更加简单 POJ 3278 Catch That Cow Time Limit: ...
- CentOS 7.2 Ubuntu 18部署Rsync + Lsyncd服务实现文件实时同步/备份
发送端配置: 一.配置密钥 1. 主/从服务器之间启用基于密钥的身份验证.登录发送端服务器并用 " ssh-keygen " 命令生成公共或私有的密钥. 2. 使用 " ...
- 前端笔记之JavaScript(五)关于数组和字符串那点事
一.数组 1.1数组概念 数组(array)是一个有序的数据集合.说白了,数组就是一组数.数组内部可以存放一个或多个单独的数据,整体组成数组. 定义数组最简单的方式:数组字面量. 数组的字面量“[]” ...
- Linux apache的运行用户和用户组
我们在安装apache后,有时在上传文件的时候,提示没有权限或者是不可写,我们都会去查文件夹的权限. 通过ls -l /var/www/html/website可以很直观的看出我们文件和文件夹的权限, ...
- 20175226 2018-2019-2 《Java程序设计》第五周学习总结
20175226 2018-2019-2 <Java程序设计>第五周学习总结 教材学习内容总结 接口 包含接口声明和接口体 接口声明interface 接口的名字 接口体中包含常量的声明( ...
- 解决springboot启动失败问题:Unable to start embedded container;
将一个springboot项目导入到eclipse后,启动时报错Unable to start embedded container,以下时全部错误信息: Application startup fa ...
- ios手机访问H5页面中$(document).on绑定无效问题
1.问题描述 用amazeUI做了个手机端网站,网站头部是一个点击按钮下拉菜单,点击页面其余区域下拉菜单隐藏.在chrome模拟安卓和iOS都可以正常触发,但是在真机实测的时候,iOS上面失效了.简单 ...