Answer the question
In order to leave comments, you need to log in
How to configure nginx php-fpm for phalcon framework in vestaCP panel?
Hello everyone
, does anyone have a template for nginx php-fpm for phalcon for the vestaCP panel? Can you share? Or help write it.
in the server settings is not very strong.
I tried to remake the laravel template taking into account Falcon's recommendations https://docs.phalconphp.com/en/3.2/webserver-setup - but it opens only the main page in response to any page.
An example of a vestacp template for laravel https://gist.github.com/semasping/85c9262ce9914176...
What I got for phalcon
server {
listen %ip%:%web_port%;
server_name %domain_idn% %alias_idn%;
root %docroot%/public;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/%domain%.log combined;
access_log /var/log/nginx/domains/%domain%.bytes bytes;
error_log /var/log/nginx/domains/%domain%.error.log error;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?_url=$uri&$args;
}
location ~ \.php {
fastcgi_pass %backend_lsnr%;;
fastcgi_index /index.php;
include /etc/nginx/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias %home%/%user%/web/%domain%/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
location /vstats/ {
alias %home%/%user%/web/%domain%/stats/;
include %home%/%user%/web/%domain%/stats/auth.conf*;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include %home%/%user%/conf/web/nginx.%domain%.conf*;
}
try_files $uri $uri/ /index.php?_url=$uri&$args;
server {
listen %ip%:%web_port%;
server_name %domain_idn% %alias_idn%;
root %docroot%/public;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/%domain%.log combined;
access_log /var/log/nginx/domains/%domain%.bytes bytes;
error_log /var/log/nginx/domains/%domain%.error.log error;
location / {
try_files $uri $uri/ /index.php?_url=$uri&$args;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass %backend_lsnr%;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias %home%/%user%/web/%domain%/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
location /vstats/ {
alias %home%/%user%/web/%domain%/stats/;
include %home%/%user%/web/%domain%/stats/auth.conf*;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include %home%/%user%/conf/web/nginx.%domain_idn%.conf*;
}
TestpathController handler class cannot be loaded
#0 [internal function]: Phalcon\Mvc\Dispatcher->_throwDispatchException('TestpathControl...', 2)
#1 [internal function]: Phalcon\Dispatcher->_dispatch()
#2 [internal function]: Phalcon\Dispatcher->dispatch()
#3 /home/admin/web/semasping.tk/public_html/public/index.php(42): Phalcon\Mvc\Application->handle()
#4 {main}
Answer the question
In order to leave comments, you need to log in
Even though it's been a year already.
Processing of non-existent routes must be done on the application side.
$router = $di->getRouter(FALSE);
//$router = Phalcon\Mvc\Router(FALSE);
...
...
$router->notFound([
'controller' => 'index',
'action' => 'route404'
]);
...
class IndexController extends ControllerBase
{
public function route404Action()
{
$this->view->disable();
$this->response->setRawHeader('HTTP/1.1 404 Not Found');
$this->response->setContent('<b>404, bratishka :(</b>');
$this->response->send();
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question