Welcome! Log In Create A New Profile

Advanced

Re: Замена content-type image/webp в location

November 07, 2019 08:21PM
А как здесь location /webp прикрутить? подскажите.
Вот полный конфиг хоста

server {
server_name mysite www.mysite;
charset UTF-8;
index index.php index.html;
disable_symlinks if_not_owner from=$root_path;
include /etc/nginx/vhosts-includes/*.conf;
include /etc/nginx/vhosts-resources/mysite/*.conf;
access_log /var/www/httpd-logs/mysite.access.log;
error_log /var/www/httpd-logs/mysite.error.log notice;
set $root_path /var/www/www-root/data/www/mysite;
root $root_path;
location / {
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @fallback;
}
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf|woff|woff2|ico|ttf)$ {
try_files $uri $uri/ @fallback;
}
location / {
try_files /does_not_exists @fallback;
}
}
location @fallback {
proxy_pass http://127.0.0.1:8080;
proxy_redirect http://127.0.0.1:8080 /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
access_log off;
}
return 301 https://$host:443$request_uri;
gzip on;
gzip_comp_level 9;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
listen 55.55.55.55:80;
}
server {
server_name mysite www.mysite;
ssl_certificate "/var/www/httpd-cert/www-root/mysite_le3.crtca";
ssl_certificate_key "/var/www/httpd-cert/www-root/mysite_le3.key";
ssl_ciphers EECDH:+AES256:-3DES:RSA+AES:!NULL:!RC4;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_dhparam /etc/ssl/certs/dhparam4096.pem;
charset UTF-8;
index index.php index.html;
disable_symlinks if_not_owner from=$root_path;
include /etc/nginx/vhosts-includes/*.conf;
include /etc/nginx/vhosts-resources/mysite/*.conf;
access_log /var/www/httpd-logs/mysite.access.log;
error_log /var/www/httpd-logs/mysite.error.log notice;
set $root_path /var/www/www-root/data/www/mysite;
root $root_path;


location / {
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @apacheback;
}
location ~* ^.+\.(gif|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf|woff|woff2|ico|ttf|eot|otf|flv)$ {
try_files $uri $uri/ @fallback;
expires 365d;
}
location ~* ^.+\.(jpg|jpeg|png)$ {
set $ax 0;
if ( $http_accept ~* "webp" ) {
set $ax 1;
}
if ( -e $root_path/webp$uri ){
set $ax "${ax}1";
}
if ($http_cookie ~* "modx_admin" ) {
set $ax 0;
}
if ( $ax = "11" ) {
rewrite ^ /webp$uri break;
add_header Vary Accept;
add_header Content-Type image/webp;
}

#types { } default_type "image/webp";

expires 365d;
try_files $uri $uri/ @fallback;
}
location / {
try_files /does_not_exists @fallback;
}
}
location @fallback {
proxy_pass http://127.0.0.1:6081;
proxy_redirect http://127.0.0.1:6081 /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
access_log off;
}
location @apacheback {
proxy_pass http://127.0.0.1:8080;
proxy_redirect http://127.0.0.1:8080 /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
access_log off;
}
gzip on;
gzip_comp_level 9;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
listen 55.55.55.55:443 ssl http2;
}
Subject Author Posted

Замена content-type image/webp в location

commeta November 06, 2019 04:44PM

Re: Замена content-type image/webp в location

Илья Шипицин November 06, 2019 04:54PM

Re: Замена content-type image/webp в location

commeta November 06, 2019 06:19PM

Re: Замена content-type image/webp в location

NickLavlinsky November 07, 2019 03:29AM

Re: Замена content-type image/webp в location

commeta November 07, 2019 07:53AM

Re: Замена content-type image/webp в location

damir bikmuhametov November 07, 2019 08:30AM

Re: Замена content-type image/webp в location

Илья Шипицин November 07, 2019 08:30AM

Re: Замена content-type image/webp в location

commeta November 07, 2019 08:21PM

Re: Замена content-type image/webp в location

commeta November 07, 2019 10:30PM

Re: Замена content-type image/webp в location

damir bikmuhametov November 07, 2019 10:26PM

Re: Замена content-type image/webp в location

vitcool November 07, 2019 08:24AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 106
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