0
特定のURLをHTTPSリダイレクトから除外しようとしています(すべてのトラフィックがHTTPからHTTPSにリダイレクトされるため、HTTP経由で1つのURLにアクセスできます)。特定のURLをNGINX vhostのHTTPSリダイレクトから除外する
除外するためのURL:
http://www.domain.com/index.php?route=extension/something/something
マイVHOSTのdomain.com.conf:
server{
listen 80;
listen 443 ssl;
server_name domain.com www.domain.com;
ssl on;
if ($scheme = "http") {
rewrite ^/(.*)$ https://$host/$1 permanent;
}
index index.php index.html;
root /var/www/domain.com;
keepalive_timeout 60;
ssl_certificate /etc/nginx/ssl/domain.com.crt;
ssl_certificate_key /etc/nginx/ssl/domain.com.key;
location ~ \.php$ {
try_files $uri = 404;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
}
location /image/data {
autoindex on;
}
location /upload {
autoindex on;
allow all;
log_not_found off;
}
location /admin {
index index.php;
}
location/{
try_files $uri @opencart;
}
location @opencart {
rewrite ^/(.+)$ /index.php?_route_=$1 last;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~* \.(xml|csv|xls)$ {
allow all;
log_not_found off;
}
location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ {
deny all;
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location ~* \.(jpg|jpeg|png|gif|css|js|ico)$ {
expires max;
log_not_found off;
}
}
私はすべてをGoogleで検索し、成功せず、ここからすべてのヒントを試してみました。
は素晴らしいソリューションをありがとうございました。私は別の質問があります:これらの状況のための書き換えを追加してHTTPを返す方法^/googlebase.xml $ /index.php?route=feed/google_base last; – Autreau
http処理中に書き直しをしたいと思ったら、if($ scheme = "http"){書き直し^/googlebase.xml $ /index.php?route=feed/google_base last; }を3番目のifブロックの下に置きます。 – Satys