nginx serve multi index files from location

Tags: nginx
By : E_Jovi
Source: Stackoverflow.com
Question!

I want to archive that serving variable html file through different uri, below is my config.

server {
  listen 8888;
  server_name localhost;

  location / {
    root html/test
    index foo.html
  }

  location /another {
    root html/test
    index bar.html
  }
}

I want request for localhost:8888/another then response bar.html which present in my test directory, but I'm failed :(

how could I fix above config, thanks for your time.

By : E_Jovi


Answers

The filename is constructed from the value of the root directive and the URI. So in this case:

location /another {
    root html/test;
    index bar.html;
}

The URI /another/bar.html will be located at html/test/another/bar.html.

If you want the value of the location directive to be deleted from the URI first, use the alias directive.

location /another {
    alias html/test;
    index bar.html;
}

The URI /another/bar.html will be located at html/test/bar.html.

See this document for details.



Shouldn't this be sufficient? Just notice this will remove .denominator, and replace the inner text with desired value.

$('.medium-item-price').text('$1')

$('.medium-item-price').text('$1');
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<div class="medium-item-price"><span class="denominator">$</span>699.99</div>

By : Adam Azad


You can do it like following.

$('.medium-item-price').contents().last()[0].textContent='100';
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="medium-item-price">
  <span class="denominator">$</span>
  699.99
</div>

By : Azim


This video can help you solving your question :)
By: admin