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;





}
相关推荐
qq_479875431 分钟前
TcpConnection
运维·服务器·网络
Ghost Face...1 小时前
GRUB配置文件解析与启动流程详解
linux·运维·服务器
掘根2 小时前
【Docker】容器操作和实战
运维·docker·容器
前端世界6 小时前
从零搭建多子网 DHCP 服务:CentOS 双网卡多作用域实战与原理解析
linux·运维·centos
头发那是一根不剩了7 小时前
Docker Desktop 安装教程和最佳实践
运维·docker·容器
路由侠内网穿透.8 小时前
本地部署轻量级持续集成工具 Drone CI 并实现外部访问
运维·服务器·ci/cd·远程工作
tianyuanwo8 小时前
K8s Dashboard运维技巧全面经验总结
linux·运维·kubernetes
无敌的牛9 小时前
Linux操作系统
linux·运维·服务器
半梦半醒*9 小时前
k8s——services资源+pod详解1
linux·运维·docker·kubernetes·centos·负载均衡
IndulgeCui9 小时前
【金仓数据库产品体验官】KSQL Developer Linux版安装使用体验
linux·运维·数据库