Nginx跨域配置方法
配置文件如下,重点在49~52行
#user nobody;
worker_processes ; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections ;
} 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 ;
keepalive_timeout ; #gzip on; server {
listen ;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / {
root web;
index index.html index.htm;
} location ^~/proxy/html/{
rewrite ^/proxy/html/(.*)$ /$ break;
#root proxy;
proxy_pass http://localhost:81;
}
#error_page /.html; # redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:;
# 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 ;
# listen somename:;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen 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跨域配置方法的更多相关文章
- 014.Nginx跨域配置
一 跨域概述 1.1 同源策略 同源策略是一个安全策略.同源,指的是协议,域名,端口相同.浏览器处于安全方面的考虑,只允许本域名下的接口交互,不同源的客户端脚本,在没有明确授权的情况下,不能读写对方的 ...
- 跨域原因及SpringBoot、Nginx跨域配置
目录 概述 简单请求 跨域解决方案 概述 SpringBoot跨域配置 Nginx跨域配置 概述 MDN文档 Cross-Origin Resource Sharing (CORS) 跨域的英文是Cr ...
- Windows平台下nginx跨域配置
1)下载地址: http://nginx.org 2)启动 解压至d:\nginx,运行nginx.exe(即nginx -c conf\nginx.conf),默认使用80端口,日志见文件夹D:\n ...
- nginx跨域配置
假设前端页面的地址为: 192.168.1.1/arcgis40/index.html 页面物理路径为: X:\nginx-1.9.15\html\arcgis40 那么请求服务时,当ajax代码如下 ...
- nginx跨域配置(windos走过的坑)
nginx下载地址: http://nginx.org/en/download.html 红圈区域是稳定版 解压之后放在文件夹就可以了. 解压后: 注意:这里面有个nginx.exe文件,一般情况下双 ...
- nginx 跨域配置
server { listen 80; server_name b.com; location /{ if ( $http_referer ~* (a.com|b.com|c.com) ) { Acc ...
- nginx-springboot-vue前后端分离跨域配置
nginx-springboot-vue前后端分离跨域配置 引言 接着上篇--简单的springboot-vue前后端分离登录Session拦截的demo,其中跨域是通过springboot后端全局设 ...
- windows上 nginx 配置代理服务,配置多域名,以及最简单实现跨域配置
Nginx,不用多说啦,大家都熟悉的不能再熟悉了,它是一款轻量级的高性能Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,最近在本地研究将nginx和resin配合使用,使服务 ...
- Nginx跨域访问场景配置和防盗链
跨域访问控制 跨域访问 为什么浏览器禁止跨域访问 不安全,容易出现CSRF攻击! 如果黑客控制的网站B在响应头里添加了让客户端去访问网站A的恶意信息,就会出现CSRF攻击 Nginx如何配置跨域访问 ...
随机推荐
- Linux使用mount挂载samba共享
# 挂载smb使用读写777权限sudo mount -t cifs -o "rw,dir_mode=0777,file_mode=0777,username=winuser,passwor ...
- C++ 箴言
1.把C++当成一门新的语言学习: 2.看<Thinking In C++>,不要看<C++变成死相>: 3.看<The C++ Programming Language ...
- JDBC查询数据库中的数据
只用JDBC技术查询表中的全部内容时,需要使用查询全部的SQL语句,把查询结果放到List集合中. package qddx.JDBC; import java.util.*; import java ...
- iOS分析UI利器——Reveal及简单破解方法
Reveal作为分析APP UI的利器确实非常好用,用来查看任意UI布局也很方便 一.模拟器进行分析 1.打开Reveal(http://revealapp.com下载) 2.打开Xcode 3.Re ...
- Android自定义View之倒计时Countdown实现
先看一下效果: 在点击OK键之后,开始倒计时. 实现步骤 1.新建Android工程"CountdownView" 2.自定义Drawable 自定义View并没有直接的用户交互, ...
- Django 创建APP简单步骤
yum install epel-releaseyum install python34yum install python-pippip install django django-admin st ...
- 配置JDK环境变量,与各步骤的意义
配置JDK环境变量 1,新建变量名:JAVA_HOME,变量值:C:\Program Files\Java\jdk1.7.0 (变量值为jdk安装路径) 2,打开P ...
- bzoj2441 小W的问题
bzoj2441 按照纵坐标排序,从小到大插入数列中,每个点i维护一个data[i]表示未插入序列中横坐标小于i的数的个数(用线段树)其实点i就是“W”中第一个极小点,那么f[j]就等于1到j-1中所 ...
- 使用"立即执行函数"(Immediately-Invoked Function Expression,IIFE)
一.原始写法 模块就是实现特定功能的一组方法. 只要把不同的函数(以及记录状态的变量)简单地放在一起,就算是一个模块. function m1(){ //... } function m2(){ // ...
- VS2008基于对话框的MFC上位机串口通信(C++实现)简单例程
首先,在 vs2008 环境下创建 MFC 运用程序 设置项目名称为 ComTest(这个地方随意命名,根据个人习惯),点击确定后,点击下一步 出现如下界面 选择"基于对话框"模式 ...