G
G
gqa2020-10-26 17:16:16
PHP
gqa, 2020-10-26 17:16:16

The php file is downloaded to nginx (ospanel). What's wrong with him?

/frontend/build/ - nuxt.js /www/index.php
- php file that processes requests like /api/orders

it's in the default config. FastCGI installed, but it still didn't work, error:

No connection could be made because the target machine actively refused it) while connecting to upstream

Apparently this is a problem due to the fact that fastcgi_pass is not correctly specified?

The bottom line is that with such locations, php from the /frontend/build/ folder is processed, and downloaded from the /www/ folder, moreover, if I write the same proxy_pass settings in the location /api/, then the server does not start at all ..

What is the difference between fastcgi_pass and proxy_pass? How to find out fastcgi_pass? What am I doing wrong?

location ~ ^/api/(.*)$ {
    root 'путь/www/';
    rewrite ^/api/(.*)$ /index.php?q=$1 break;
}

location / {
    root 'путь/frontend/build/';
    try_files $uri /index.html;

    proxy_set_header          Host $host;
    proxy_set_header          X-Forwarded-For $http_x_forwarded_for;
    proxy_set_header          X-Real-IP $remote_addr;
    proxy_set_header          X-Forwarded-Proto $scheme;
    proxy_pass                http://%ips%:%httpbackport%/frontend/dist/;
}


What to write in location /api so that php is processed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2020-10-26
@delphinpro

Look at the \userdata\config\Nginx-1.14_vhost.conf file and make your host by analogy.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question