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;





}
相关推荐
G_H_S_3_3 小时前
【网络运维】Docker 存储:镜像层与数据卷的管理应用
linux·运维·网络·docker
手揽回忆怎么睡6 小时前
Alibaba Linux 8安装jdk25
linux·运维·服务器
❀͜͡傀儡师6 小时前
docker一键部署网页版Win11系统
运维·docker·容器
2301_800050996 小时前
华为云介绍
运维·华为云
lifewange7 小时前
测试场景 Linux 命令速查表
linux·运维·服务器
姚青&8 小时前
Linux 命令介绍以及帮助命令介绍
linux·运维·服务器
遇见火星8 小时前
详解 Linux 中的 /etc/fstab 文件
linux·运维·服务器
menggb078 小时前
在Linux系统上安装和使用Prometheus+Grafana
linux·运维·prometheus
苹果醋39 小时前
iview— Select— Option选中后有空格
运维·vue.js·spring boot·nginx·课程设计
wregjru9 小时前
【操作系统】linux常用指令
linux·运维·服务器