栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

nginx | nginx 代理服务

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

nginx | nginx 代理服务

nginx 代理服务
  • 1. nginx 安装
  • 2. nginx 代理服务

1. nginx 安装

https://blog.csdn.net/qq825478739/category_11423046.html

2. nginx 代理服务

修改配置文件 nginx.conf
server 服务
listen 端口 这里需要注意 端口号
location 代理地址

#user  nobody;
worker_processes  1;

events {
    worker_connections  1024;
}



http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
 
    keepalive_timeout  65;


    server {
        listen       80;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }
      
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }   
    }

##代理的服务
	server {
        listen       8080;
        server_name  javaserver;
		
		#*星号代表任意跨源请求都支持   服务处理跨域请求 nginx就不需要在处理跨域了
        #add_header Access-Control-Allow-Origin '*';  
        #add_header Access-Control-Allow-Credentials "true";
		#add_header Access-Control-Allow-Methods 'GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACES';
		#add_header Access-Control-Allow-Headers  'x-requested-with,authorization,Content-Type,farm,store';
		#if ($request_method = 'OPTIONS') {
		#	return 200;
		#}
		
		# 代理 跳转地址
		location /VideoPlatform {
			proxy_pass http://192.168.8.105:8000/VideoPlatform;
		}
		
		# 代理 跳转地址
		location / {
			proxy_pass http://127.0.0.1:8000/;
		}
       
    }
  
}

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/914475.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号