alias domain with path

Discussion in 'ISPConfig 3 Priority Support' started by DylanPedro, Feb 8, 2018.

  1. DylanPedro

    DylanPedro Member

    Hi,

    on apache it was possible to create an alias domain like this
    Code:
    Alias /images "/var/www/html/example.com/images"
    
    <Directory "/var/www/html/example.cpm/images">
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    This would allow files to be server form example.com/images without the folder actually being in the web route of that domain.

    Is it possible to do something similar on nginx using ISPConfig as the alias domain feature seems like the same but it does not allow you to add a foldername to the end of the name e.g. example.com/images ?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

  3. DylanPedro

    DylanPedro Member

    Thanks Till it works!
     
  4. DylanPedro

    DylanPedro Member

    Hi Till,

    What does the following line do as it is preventing the alias location to serve any jpg files and keeps showing a 404 error
    Code:
           location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
                    expires max;
                    log_not_found off;
           }
    removing this line allows jpg files to be server from the correct folder. I have the following in the directive so far but this causes the 404 error:
    Code:
    location / {
                    try_files $uri $uri/ /index.php?$args;
           }
           # Add trailing slash to */wp-admin requests.
           rewrite /wp-admin$ $scheme://$host$uri/ permanent;
           location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
                    expires max;
                    log_not_found off;
           }
    location /images {
        alias /var/www/clients/client0/web6/images;
      }
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    The line sets the expires header for specific file types, so that the browser caches it.
     
  6. DylanPedro

    DylanPedro Member

    So Why does adding this line stop the alias below is and it starts working after removing it?

    Does it make a difference what order it is written in?
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    The order of directives might matter. But you might want to contact the developers of the nginx software if you have questions about how the internals of their software work as this question is not related to ISPConfig.
     

Share This Page