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;
}
}
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;
}
}