V4 Help wtih short domain for static files


I used to create a server block in v3 for sites short domains for static files.

server {

  server_name example.com www.example.com;

  root /var/www/example.com/htdocs;

  access_log /var/log/nginx/example.com.access.log rt_cache_redis;
  error_log /var/log/nginx/example.com.error.log;

  index index.php index.html index.htm;

  include  common/redis-php7.conf;  
  include common/wpcommon-php7.conf;
  include common/locations-php7.conf;
  include /var/www/example.com/conf/nginx/*.conf;

server {

  server_name eg.com;

  root /var/www/example.com/cdn/uploads;

  sendfile   on;
  tcp_nopush on;

  # Cache static files
  location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|swf)$ {
    add_header "Access-Control-Allow-Origin" "*";
    access_log off;
    log_not_found off;
    expires max;

How do I achieve this in v4? I get nginx errors when I add the static domain server block in the sites custom.conf

Currently It’s not possible to do it in v4. To do it, we need alias domain feature and ability to add custom nginx configuration in http context.

Once these features are present, then you can do what you described above. Until then, unfortunately, you cannot :slightly_frowning_face:

Thanks for your time and knowledge, back to v3 or WordOps I go.

Closing the thread as your question seems to have answered.