G
G
gqa2020-10-24 22:32:21
Nginx
gqa, 2020-10-24 22:32:21

How to set location for nginx in ospanel?

Installed OSPanel (Open Server) on windows.
Configuration: Apache_2.4-PHP_7.2-7.3-x64+Nginx_1.17_vhostn.conf
which contains the following parameters:

location ~ ^/api/(.*)$ {
    root '%hostdir%/www';
    try_files $uri $uri/ /index.php;
}

location / {
    root '%hostdir%/frontend/build';
    try_files $uri /file.html;
}


The idea is to separate nuxt.js, which is located in the "frontend" folder, and the backend, which works on demand, for example: /api/order, but to the index.php file in the /www/ folder,

i.e. it turns out:
1. /frontend/ (nuxt.js)
2. /www/index.php (api)

So, when requesting the nuxt domain from the /frontend/build folder, it works, but when requesting /api/test, it gives the same 404 error nuxt. What's wrong here?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question