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;





}
相关推荐
一位摩羯座DBA36 分钟前
Redhat&Centos挂载镜像
linux·运维·centos
charlee441 小时前
nginx部署发布Vite项目
nginx·性能优化·https·部署·vite
cui_win2 小时前
【网络】Linux 内核优化实战 - net.core.flow_limit_table_len
linux·运维·网络
风清再凯2 小时前
自动化工具ansible,以及playbook剧本
运维·自动化·ansible
深圳安锐科技有限公司2 小时前
深圳安锐科技发布国内首款4G 索力仪!让斜拉桥索力自动化监测更精准高效
运维·安全·自动化·自动化监测·人工监测·桥梁监测·索力监测
猫头虎2 小时前
猫头虎 AI工具分享:一个网页抓取、结构化数据提取、网页爬取、浏览器自动化操作工具:Hyperbrowser MCP
运维·人工智能·gpt·开源·自动化·文心一言·ai编程
CRMEB定制开发3 小时前
【实战】CRMEB Pro 企业版安装教程(附 Nginx 反向代理配置 + 常见问题解决)
nginx·商城系统·微信商城·crmeb
cocologin4 小时前
RIP 技术深度解析
运维·网络·网络协议
庸子4 小时前
基于Jenkins和Kubernetes构建DevOps自动化运维管理平台
运维·kubernetes·jenkins
Lpy25694 小时前
Docker Desktop 安装到D盘(包括镜像下载等)+ 汉化
运维·docker·容器