У меня есть сервер Ngnix, на котором я настраиваю два приложения.
Один на / и другой на /learning.
Проблема, с которой я сталкиваюсь, заключается в том, что / learning извлекает содержимое /. Например, файлы css и изображения из / извлекаются также из / обучения пути. Так что я получаю сообщение об ошибке. Я пробовал все решения из стека за потоком, где я не могу решить.
Прикрепление кода для вашей справки.
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
proxy_pass http://localhost:3000; #whatever port your app runs on
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /learning {
rewrite ^/learning(.*) $1 break;
proxy_pass http://localhost:3001;
}
Ошибка из веб-браузера
Где путь должен быть www.chamakatech.com/learning/images/ Но я получаю www.chamakatech.com/images/ В браузере
Пожалуйста, помогите мне, как отрисовать файлы из www.chamakatech.com/learning. / etc / nginx / sites-available / default
<div id="trustee">
<section class="trustees">
<div class="container">
<div>
<p class="text-center" style="color:black">Our Trustable Trustees!!</p>
<div class="row">
<div class="col-lg-4" style="background-color: blue;">
</div>
<div class="col-lg-4" style="background-color: red">
</div>
<div class="col-lg-4" style="background-color: green;">
</div>
</div>
<div class="row">
<div class="col-lg-4 new" >
<div class="card" style="width: 18rem;">
<img class="card-img-top" src="../images/sridhar.jpg" alt="Card image cap">
<div class="card-body">
<h5 class="card-title">Sridharan.E</h5>
<p class="text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
</div>
<div class="col-lg-4 new" >
<div class="card" style="width: 18rem;">
<img class="card-img-top" src="../images/ramachandran.jpg" alt="Card image cap">
<div class="card-body">
<h5 class="card-title">Ramachanran.E</h5>
<p class="text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
</div>
<div class="col-lg-4 new" >
<div class="card" style="width: 18rem;">
<img class="card-img-top" src="../images/sri.jpg" alt="Card image cap">
<div class="card-body">
<h5 class="card-title">Srivarshini.S</h5>
<p class="text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-4 new" >
<div class="card" style="width: 18rem;">
<img class="card-img-top" src="../images/ashwanth1.png" alt="Card image cap">
<div class="card-body">
<h5 class="card-title">Ashwanth .S</h5>
<p class="text new">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
</div>
</div>
</div>
</div>
</section>