如何在nginx上禁用特定URL上的ssl

时间:2015-08-17 14:45:09

标签: nginx

我需要一些nginx配置的帮助。所以请帮忙。所以这是我的情况。

我的域名:rtechmedia.com

1)我希望http:// www.rtechmedia.com的所有请求重定向到https:// www.rtechmedia.com

2)我想要https:// rtechmedia.com的所有请求到https:// www.rtechmedia.com

3)但我希望位于www.rtechmedia.com/styles/*的样式文件夹及其内容应重定向到http:// www.rtechmedia.com/styles/*而不是https:// www。 rtechmedia.com/styles/*

我是nginx的noob,所以请详细说明。请注意,由于声誉低,我将空间放入网址。所以忽略它

我能够实现1)和2)而不是3,所以请帮助我。

server {
    listen 80;
    server_name www.rtechmedia.com;
    return 301 https://www.rtechmedia.com$request_uri;

}
server {
    listen 80;
    server_name rtechmedia.com;
    return 301 https://www.rtechmedia.com$request_uri;
}
server {
    listen 443 ssl;
    server_name www.rtechmedia.com;
    root /home/forge/www.rtechmedia.com;

    ssl_certificate /etc/nginx/ssl/www.rtechmedia.com/11369/server.crt;
    ssl_certificate_key /etc/nginx/ssl/www.rtechmedia.com/11369/server.key;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }


    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/www.rtechmedia.com-error.log error;

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }
}

0 个答案:

没有答案