0
我想從HTTPS重定向中排除特定的URL(所有流量都從HTTP重定向到HTTPS,所以我想通過HTTP訪問一個URL)。排除NGINX vhost上的HTTPS重定向的具體URL
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最後; – Autreau
我想你想在http處理過程中重寫,如果($ scheme =「http」){重寫^/googlebase.xml $ /index.php?route=feed/google_base最後; }低於第三個if塊。 – Satys