I have a setup of docker-compose having nginx and wordpress. I followed one of the tutorials across the web and everything seems to work fine.
BUT I have one critical plugin which generates a couple of html/js files directly via PHP. Meaning HTML code contains <script>
tag with path to /script.js
, plugin catches that particular name and respond with appropriate content. No url-rewrite modules involved here, only some self-written (i.e. from plugin)
I can't figure out how to configure nginx to allow fpm docker image to serve that server-side generated js.
Now I have the following setup:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~* \.php$ {
fastcgi_pass wordpress:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
location ~ ^/(script1.js|script2.js) {
fastcgi_pass wordpress:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
location ~* \.(css|js|gif|ico|jpeg|jpg|png)$ {
expires max;
log_not_found off;
}
Once I reaquest the page, script1 and script2 respond with 404.
Is this possible to achieve in general?