B
B
BloodVIRUS2016-01-14 11:26:45
MODX
BloodVIRUS, 2016-01-14 11:26:45

How to redirect to virtual js file in nginx?

Hello! Previously, the site worked on Apache, under the control of ISP, everything worked. Now the needs have changed, I moved the site to nginx + fcgi, and something stopped working. Namely:
in my cmf (modx) an url was created, type js, api.js. The file itself did not exist in the directory, it was virtual, it could be obtained through /index.php?q=api.js, . Now nginx is trying to fetch the real file, and it gives a 404 error. I've been trying to google all morning how to:
if nginx doesn't find the file it needs, it goes to index.php?q=request. But at the same time, the url did not change, as they turned to /petarda.html, the url remained the same. And on the server it was /index.php?q=petarda.html
or do it with only one api.js I share
the current config to the domain: pastebin.com/Q2ssP4Ax
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vlad Zhivotnev, 2016-01-14
@inkvizitor68sl

location =/api.js {
rewrite .* /index.php?q=api.js ;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question