Answer the question
In order to leave comments, you need to log in
How to intercept php requests in nginx?
I have a simple flask application for buying goods, to integrate the CDEK pickup widget, you need to place a php file on the server, a link to which must be specified in the js script, an example (from the CDEK documentation):
<script type="text/javascript">
var ourWidjet = new ISDEKWidjet ({
...
servicepath: 'http://yoursite.net/service.php', //ссылка на файл service.php на вашем сайте
...
});
</script>
server {
server_name yoursite.net www.yoursite.net;
location / {
include proxy_params;
proxy_pass http://unix:/home/user/myproject/project.sock;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/yoursite.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/yoursite.net/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.yoursite.net) {
return 301 https://yoursite.net$request_uri;
} # managed by Certbot
if ($host = yoursite.net) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name yoursite.net www.yoursite.net;
return 404; # managed by Certbot
}
Answer the question
In order to leave comments, you need to log in
How can I configure my nginx so that when this path is requested, the server does not send it to gunicorn-flask for processing, but executes php itself and returns the desired response?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question