nginx配置

需求:

1.访问 test.com ,跳转到https://test2.com/goto.php

  1. test.com子目录m,不跳转

  2. test.com子目录abc,不跳转

nginx配置

bash 复制代码
server {
    listen       80;
    client_max_body_size 60m;
    server_name  test.com;
    location /m {
        root   /data/webapp/test/m;
        index  index.php index.html index.htm login.php;
    }
	
    location /abc {
        root   /data/webapp/test/abc;
        index  index.php index.html index.htm login.php;
    }

    location / {
        root   /data/webapp/test;
        index  index.php index.html index.htm login.php;

		return 301 https://test2.com/goto.php?url=$request_uri;

    }

    access_log   /data/weblogs/test_161_1_access.log  access;



}




server {
    listen       443;
    client_max_body_size 60m;
    server_name  test.com;

    ssl          on;
    ssl_certificate      /data/app/nginx/ssl/server.crt;
    ssl_certificate_key  /data/app/nginx/ssl/server.key;

	ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
	ssl_prefer_server_ciphers on;
	ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE;
	ssl_session_timeout 5m;
	ssl_session_cache builtin:1000 shared:SSL:10m;

    location /m {
        root   /data/webapp/test;
    }

    location /abc {
        root   /data/webapp/test;
    }

    location / {
        root   /data/webapp/test;
        index  index.php index.html index.htm login.php;

		return 301 https://test2.com/goto.php?url=$request_uri;

    }

    access_log   /data/weblogs/test_ssl_161_1_access.log  access;





}
相关推荐
守护砂之国泰裤辣10 分钟前
React项目Docker部署的简单配置
运维·docker·容器
xlq2232223 分钟前
9.make_进度条
linux·运维·服务器
玄斎41 分钟前
华为ENSP配置实验:双网段互通 + DNS 解析 + Web 访问,一步实现全网可达(基础)
运维·服务器·网络·学习·华为·hcia·ensp
苏三福42 分钟前
clawdbot 使用
linux·运维·ubuntu
岳来1 小时前
docker 容器参数LinkLocalIPv6Address 和 LinkLocalIPv6PrefixLen
运维·docker·容器·ipv6
海域云-罗鹏1 小时前
该如何选择深圳进行算力服务器托管
运维·服务器
init_23611 小时前
【hcie-09】vxlan 同子网通信
linux·运维·服务器
爱吃生蚝的于勒1 小时前
【Linux】进程信号的产生(一)
linux·运维·服务器·c语言·开发语言·数据结构·c++
橙露1 小时前
云原生运维实战:阿里云 ECS 服务器安全加固与性能调优指南
运维·阿里云·云原生
China_Yanhy1 小时前
我的区块链运维日记 · 第 7 日:影子区块的诱惑 —— 多节点下的“重复充值”危机
运维·区块链