title: Nginx redirect image page
body: <p>I want to change the URL of my website so that it can be seen when the user clicks Open Image in New Tab in the browser. For the original state when a new tab is shown in the browser, the url is like this:</p>
  <pre><code>https://cms-domain.dev/storage/images/post/example1.jpg
  </code></pre>
  <p>what I want is like this:</p>
  <pre><code>https://frontend-domain.dev/storage/images/post/example1.jpg
  </code></pre>
  <p>I want to try to manipulate it with nginx so that my cms url is not visible.</p>
  <p>this is my nginx config</p>
  <pre><code>server {
          server_name frontend-domain.dev;
          location / {
              proxy_pass http://localhost:54000;
              proxy_redirect     off;
              proxy_set_header   Host $host;
              proxy_set_header   X-Real-IP $remote_addr;
              proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header   X-Forwarded-Host $server_name;
        
          }
          location /storage {
                      alias /home/project-cms/public/storage;
                      try_files $uri $uri/ @storage;
  
               location ~ \.php$ {
                       include snippets/fastcgi-php.conf;
                       fastcgi_param SCRIPT_FILENAME $request_filename;
                       fastcgi_pass unix:/run/php/php8.0-fpm.sock;
                      }
          }
  
          location @storage {
                rewrite /storage/(.*)$ /storage/*.jpg?/$1 last;
          }
  </code></pre>
  <p>when I verify my Nginx config, the config has no problem but when I try again to open the image in a new tab it still shows the cms URL.</p>
  <p>Is there any configuration is wrong?</p>