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;





}
相关推荐
志栋智能8 小时前
低成本自动化巡检:7×24小时守护业务稳定
运维·网络·自动化
ToB营销学堂9 小时前
MarketUP | B2B 自动化营销实战:如何打破“营-销”数据孤岛,构建高转化线索流?
运维·自动化
CDN3609 小时前
360CDN 全系列产品体验:CDN / 高防 / SDK 游戏盾横向测评
运维·安全·游戏
行者-全栈开发10 小时前
容器化时代来临 - Docker 技术演进与核心价值
运维·docker·容器·cicd·自动化构建·容器化时代
云飞云共享云桌面10 小时前
非标自动化研发成本高?云飞云共享云桌面:1台主机=10台工作站,年省数十万。
大数据·运维·服务器·人工智能·自动化·云计算·电脑
chehaoman10 小时前
Failed to restart nginx.service Unit nginx.service not found
运维·nginx
Linux运维技术栈11 小时前
生产环境Linux应用目录迁移至LVM独立分区 标准化实战方案
linux·运维·服务器·lvm·逻辑卷
feasibility.11 小时前
SSH Agent Forwarding 与 tmux 排障笔记
linux·运维·服务器·经验分享·笔记·ssh
ShawnLiaoking11 小时前
Linux 会话窗口常开
linux·运维·服务器
CDN36012 小时前
中小团队加速 + 防护方案:360CDN+SDK 游戏盾实测
运维·游戏·网络安全