Nginx: Different static files for different URLs

خرید بک لینک

I have two web applications running on the same server, say, app1 and app2.

app1 is the ROOT application, i.e. it will be launched whenever anyone hits the URL, say, http://example.com/

app2 is another application, which will be hit when some one hits the URL, say, http://example.com/newapp/

I am using nginx as the webserver, and both web application have their own static contents (js, css, images) to be served.

for app1 I am using the following,

 location ~* .(js|css|png|jpg|jpeg|gif|ico) {
      root <path_to_tomcat>/webapps/ROOT;
      expires 1y;
      log_not_found off;
 }

this works very fine and the static contents gets served like a charm.

And for app2 I am using,

 location ~* /newapp+.(js|css|png|jpg|jpeg|gif|ico) {
      root <path_to_tomcat>/webapps/app2;
      expires 1y;
      log_not_found off;
 }

for app2 the static content never gets served.

I tried searching in net about this, but not getting exact links for serving different static based on URLs.

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 186 تاريخ: سه شنبه 11 خرداد 1395 ساعت: 14:17

صفحه بندی