Answer the question
In order to leave comments, you need to log in
How to set up the API on the same domain as the main site?
Hello everyone, how can I refer all requests sent to ex.com/api?
server {
...
set $base_root /var/www/html;
root $base_root;
location / {
proxy_pass 'http://127.0.0.1:3000';
}
location ~* \.php$ {
include fastcgi_params;
fastcgi_pass unix:/var/www/php-fpm/sock.sock;
try_files $uri =404;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* \.(css|js|jpg|jpeg|png|gif|bmp|ico|mov|swf|pdf|zip|rar)$ {
try_files $uri =404;
}
location /api {
# это место
alias $base_root/api/web/;
try_files $uri $uri /api/web/index.php$is_args$args;
#location ~ ^/api/assets/.+\.php(/|$) {
# deny all;
#}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question