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;





}
相关推荐
vvw&16 小时前
如何在 Ubuntu 上安装 PostgreSQL
linux·运维·服务器·数据库·ubuntu·postgresql
徒 花16 小时前
Nginx
运维·nginx·云原生
程序猿追16 小时前
异腾910B NPU实战:vLLM模型深度测评与部署指南
运维·服务器·人工智能·机器学习·架构
看我干嘛!17 小时前
GME 和MGRE综合实验
运维·服务器·网络
x_lrong17 小时前
Linux虚拟机配置jupyter环境并在宿主机访问
linux·运维·笔记·jupyter·虚拟机
羚羊角uou17 小时前
【Linux网络】Socket编程TCP-实现Echo Server(上)
linux·运维·服务器
少年已不再年少年轻以化为青年17 小时前
VirtualBox下虚拟机即可访问互联网,又可访问主机
运维·服务器·网络
❥ღ Komo·17 小时前
Elasticsearch单机部署全指南
运维·jenkins
CHN悠远17 小时前
debian13 安装钉钉后,钉钉无法运行问题的解决办法
linux·运维·服务器·钉钉·debian13
祎直向前17 小时前
在Ubuntu中下载gcc
linux·运维·ubuntu