Welcome! Log In Create A New Profile

Advanced

all over https except robots.txt and favicon.ico

Posted by bouseman 
all over https except robots.txt and favicon.ico
December 16, 2020 02:03PM
I need all my traffic over https, but except favicon.ico and robots.txt.
I made one like this for robots.txt, but i do not know how to do with the logical "or" operator for favicon. ico

server {
listen 80;
listen [::]:80;
server_name olgalor.ru www.olgalor.ru *.olgalor.ru;

root /home/isaev/olgalor/www;

location / {
if ( $uri !~ ^/robots\.txt) {
rewrite ^ https://olgalor.ru$request_uri? permanent;
}
}
# return 301 https://olgalor.ru$request_uri;
}

server {
listen 443 ssl;
listen [::]:443 ssl;
server_name olgalor.ru www.olgalor.ru *.olgalor.ru;

ssl_certificate /etc/ssl/olgalor_ru_cert_chain.crt;
ssl_certificate_key /etc/ssl/olgalor_ru.key;

root /home/isaev/olgalor/www;

location = /favicon.ico {
alias /home/isaev/olgalor/www/favicon.ico;
}
location /static/ {
root /home/isaev/olgalor/www;
}

location /robots.txt {
alias /home/isaev/olgalor/www/robots.txt;
}


location / {
include proxy_params;
proxy_pass http://unix:/run/olgalor.sock;
}
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 71
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready