We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on Vesta 2.0 and expect to release it by the end of 2024. Read more about it: https://vestacp.com/docs/vesta-2-development
[HOWTO] Serve static content from a cookieless domain in NGINX
[HOWTO] Serve static content from a cookieless domain in NGINX
Hey guys,
Solving that Google Pagespeed issue as well as others...
Very simply one here. For all those that know what you're doing it's a one-liner:
In EVERY template (perhaps Vesta set this has default?) in the folder /usr/local/vesta/data/templates/web/nginx/php-fpm
Change:
To
For example this file now looks like this: /usr/local/vesta/data/templates/web/nginx/php-fpm/wordpress.tpl
Solving that Google Pagespeed issue as well as others...
Very simply one here. For all those that know what you're doing it's a one-liner:
Code: Select all
fastcgi_hide_header "Set-Cookie";
Change:
Code: Select all
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
Code: Select all
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
fastcgi_hide_header "Set-Cookie";
}
Code: Select all
server {
listen %ip%:%web_port%;
server_name %domain_idn% %alias_idn%;
root %docroot%;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/%domain%.log combined;
access_log /var/log/nginx/domains/%domain%.bytes bytes;
error_log /var/log/nginx/domains/%domain%.error.log error;
location / {
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
fastcgi_hide_header "Set-Cookie";
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass %backend_lsnr%;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias %home%/%user%/web/%domain%/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include %home%/%user%/conf/web/nginx.%domain%.conf*;
}
Re: [HOWTO] Serve static content from a cookieless domain in NGINX
for better optimizationlocation ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js|eot|otf|woff|woff2|ttf|ogg)$ {
expires max;
fastcgi_hide_header "Set-Cookie";
}
Re: [HOWTO] Serve static content from a cookieless domain in NGINX
thanks for the snippets!