配置文件如下,重点在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跨域配置方法的更多相关文章

  1. 014.Nginx跨域配置

    一 跨域概述 1.1 同源策略 同源策略是一个安全策略.同源,指的是协议,域名,端口相同.浏览器处于安全方面的考虑,只允许本域名下的接口交互,不同源的客户端脚本,在没有明确授权的情况下,不能读写对方的 ...

  2. 跨域原因及SpringBoot、Nginx跨域配置

    目录 概述 简单请求 跨域解决方案 概述 SpringBoot跨域配置 Nginx跨域配置 概述 MDN文档 Cross-Origin Resource Sharing (CORS) 跨域的英文是Cr ...

  3. Windows平台下nginx跨域配置

    1)下载地址: http://nginx.org 2)启动 解压至d:\nginx,运行nginx.exe(即nginx -c conf\nginx.conf),默认使用80端口,日志见文件夹D:\n ...

  4. nginx跨域配置

    假设前端页面的地址为: 192.168.1.1/arcgis40/index.html 页面物理路径为: X:\nginx-1.9.15\html\arcgis40 那么请求服务时,当ajax代码如下 ...

  5. nginx跨域配置(windos走过的坑)

    nginx下载地址: http://nginx.org/en/download.html 红圈区域是稳定版 解压之后放在文件夹就可以了. 解压后: 注意:这里面有个nginx.exe文件,一般情况下双 ...

  6. nginx 跨域配置

    server { listen 80; server_name b.com; location /{ if ( $http_referer ~* (a.com|b.com|c.com) ) { Acc ...

  7. nginx-springboot-vue前后端分离跨域配置

    nginx-springboot-vue前后端分离跨域配置 引言 接着上篇--简单的springboot-vue前后端分离登录Session拦截的demo,其中跨域是通过springboot后端全局设 ...

  8. windows上 nginx 配置代理服务,配置多域名,以及最简单实现跨域配置

    Nginx,不用多说啦,大家都熟悉的不能再熟悉了,它是一款轻量级的高性能Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,最近在本地研究将nginx和resin配合使用,使服务 ...

  9. Nginx跨域访问场景配置和防盗链

    跨域访问控制 跨域访问 为什么浏览器禁止跨域访问 不安全,容易出现CSRF攻击! 如果黑客控制的网站B在响应头里添加了让客户端去访问网站A的恶意信息,就会出现CSRF攻击 Nginx如何配置跨域访问 ...

随机推荐

  1. PLSQL碰到pls-00103的错误解决办法

    CREATE OR REPLACE PACKAGE PKG_SHOW_CUST_DETAILS AS PROCEDURE SHOW_CUST_DETAILS( myArg VARCHAR2);END ...

  2. javascript获取浏览器窗口大小

    var w=window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var h= ...

  3. pyodbc不支持使用%,应该使用?

    pyodbc不支持使用%,应该使用? 如: Sql插入语句cur.execute("INSERT INTO bb VALUES (?,?,?)","s",&qu ...

  4. Java笔记9-正则表达式

    提纲: 1.正则表达式 2.常见的异常 3.内部类------------------------------------------------------------------JDK 1.4以后 ...

  5. 《Android深度探索HAL与驱动开发》第一章阅读心得

    首先了解到Android系统架构是由四层构成:其中第一层是Linux内核,他的作用是负责Linux的驱动程序以及内存.进程.电源等管理操作:第二层是C/C++代码库,也就是Linux下.so的文件:第 ...

  6. 记录并分享一下安卓通讯录导入到IPhone

    仅仅记录一下我自己的步骤: 前提:我开始用的是诺基亚1202,黑白屏的功能机: 1.将卡放到安卓手机里面,用应用宝导出全部联系人为VCF后缀文件: 2.下载ITools,用它连接IPhone,导入到I ...

  7. linux创建静态库

    [1]新建源程序staticlib.c /************************************************************************* > ...

  8. Oracle SQL性能优化(转)

    (1)      选择最有效率的表名顺序(只在基于规则的优化器中有效): ORACLE的解析器按照从右到左的顺序处理FROM子句中的表名,FROM子句中写在最后的表(基础表 driving table ...

  9. 结对编程--基于android平台的黄金点游戏(2.0版本)

    在昨天上传完博客之后发现一个重大的bug...故在此推出2.0版本. 博文详情见:http://www.cnblogs.com/RayShea/p/5372398.html coding地址:http ...

  10. 数迹学——Asp.Net MVC4入门指南(5):从控制器访问数据模型

    MovieController中的方法Index()代码,初认识,应该有很多理解错误的地方,暂时这么记忆吧,待随后修改 Index()代码: @model IEnumerable<MVCMovi ...