美文网首页
nginx反向代理(包含HTTPS配置)

nginx反向代理(包含HTTPS配置)

作者: WillLi | 来源:发表于2016-09-01 16:07 被阅读0次

目的

解决跨域问题

下载

http://nginx.org/en/download.html

普通配置 nginx>conf>nginx.conf

#user  nobody;
worker_processes  1;

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;

upstream localhost {  
  #根据ip计算将请求分配各那个后端tomcat,许多人误认为可以解决session问题,其实并不能。  
  #同一机器在多网情况下,路由切换,ip可能不同  
  #ip_hash;   
  server localhost:18081;  
  server localhost:18080;  
 } 

server {
    listen       80;
    server_name  localhost;
    
    #页面根路径
    location / {
        root   F:\superbuy\Orion\static;
        index  index.html index.htm;
    }

    #接口反向代理 登录接口
    location /api/site/ {
        rewrite ^.+api/site/?(.*)$ /api/site/$1 break;
        include uwsgi_params;
        proxy_pass http://login.super.com;
    }

    #接口反向代理 其他接口
    location /api/ {
        rewrite ^.+api/?(.*)$ /api/$1 break;
        include uwsgi_params;
        proxy_pass http://www.super.com;
    }
    
    error_page  404 = /index.html;
    location = /50x.html {
        root   html;
    }
}

# another virtual host using mix of IP-, name-, and port-based configuration
#
server {
    listen       8004;
    server_name  somename  alias  another.alias;

    location / {
        root   F:\superbuy\Orion\static;
        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;
#    }
#}
}

https配置

教程链接https://aotu.io/notes/2016/08/16/nginx-https/index.html

相关文章

  • nginx反向代理(包含HTTPS配置)

    目的 解决跨域问题 下载 http://nginx.org/en/download.html 普通配置 ngi...

  • # nginx https证书配置

    nginx https证书配置 一 前言 此文档针对于nginx配置反向代理使用https证书方法 nginx作为...

  • Nginx应用场景

    反向代理,负载均衡,动静分离 1.反向代理 修改nginx配置,并重新加载 重新加载nginx配置./nginx ...

  • 01-nginx前端方向代理

    前端反向代理 1.下载nginx 2. 配置nginx.conf反向代理

  • nginx

    nginx的配置、虚拟主机、负载均衡和反向代理一nginx的配置、虚拟主机、负载均衡和反向代理二nginx的配置、...

  • Nginx中配置https做反向代理 - 知识林

    本文章来自【知识林】 在Centos中的Nginx配置https做反向代理跟配置http做反向代理基本一样,只是多...

  • nginx反向代理

    什么是反向代理 如何实现反向代理 准备工作以及安装nginx 配置nginx nginx的初始配置文件去掉注释后的...

  • Nginx配置Https反向代理

    ZERO 持续更新 请关注:https://zorkelvll.cn/blogs/zorkelvll/artic...

  • Nginx配置负载均衡

    说明 Nginx的主要用途就是用来配置反向代理和负载均衡的。反向代理可以参考https://www.jianshu...

  • nginx

    node 使用 nginx 反向代理搭建https服务 使用自己生成的证书 nginx http配置 编辑ngin...

网友评论

      本文标题:nginx反向代理(包含HTTPS配置)

      本文链接:https://www.haomeiwen.com/subject/dxzcettx.html