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;





}
相关推荐
视觉震撼43 分钟前
本地机器远程连接配置与文件传输可行性检测工具
运维·服务器·网络·windows·php·apache
yuanManGan44 分钟前
走进Linux的世界:虚拟内存空间
linux·运维·服务器
宇钶宇夕1 小时前
自动化工程师入门:TIA Portal V19 从下载到运行完整攻略(避坑指南 + 功能详解)
运维·自动化
q***55582 小时前
使用 Nginx 搭建代理服务器(正向代理 HTTPS 网站)指南
运维·nginx·https
梁正雄7 小时前
linux服务-Nginx+Tomcat+Redis之Session 共享 - 容器单机版
linux·nginx·tomcat
wanhengidc7 小时前
云手机是由什么组成的?
运维·服务器·web安全·游戏·智能手机
wanhengidc11 小时前
网站服务器都有哪些作用?
运维·服务器·科技·智能手机·云计算
m0_4887776511 小时前
Web与Nginx网站服务
nginx·web
百***757411 小时前
linux上redis升级
linux·运维·redis
小小编程能手12 小时前
Linux文件编程
linux·运维·服务器