We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Create phalcon project inside phalcon project in nginx web server

I create phalcon project inside of phalcon project. example, i already have phalcon project in my domain pradha.id and then i create project on

phalcon_project_folder/public/sample/tbf

/tbf is my new phalcon project wich contain folder app and public. I have succeeded to show my home new phalcon project with url pradha.id/sample/tbf but, when i access controller like pradha.id/sample/tbf/asdf it's only show error 404 Not Found with nginx error :

[error] 10048#10048: *1 open() "/main_phalcon_project/public/sample/tbf/public/asdf" failed (2: No such file or directory)

and here is my nginx conf :

server {
  listen       443 ssl http2;
  server_name  www.pradha.id;

  set $root_path 'main_phalcon_project/public';

  root   $root_path;
  index  index.php index.html index.htm;

  try_files $uri $uri/ /index.php?_url=$uri&$args;

  error_page   500 502 503 504  /50x.html;
  location = /50x.html {
      root   /usr/share/nginx/html;
  }

  location /robots.txt {
      add_header Content-Type text/plain;
      return 200 "User-agent: *\nDisallow: \n";
  }
  location ~ ^/(sitemap.xml) {
      root $root_path;
  }
  location @tbf {
      rewrite ^/tbf/public(.+)$ /index.php?_url=$uri&$args; 
  }

  location /sample/tbf/ {
      root 'main_phalcon_project/public/sample/tbf/public';
      index index.php index.html index.htm;

      if ($uri !~ ^/sample/tbf/public) {
          rewrite ^/sample/tbf(.*)$ /sample/tbf/public$1;
      }
      try_files $uri $uri/ @tbf;
  }

  location ~ \.php$ {
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_split_path_info       ^(.+\.php)(/.+)$;
      fastcgi_index  index.php;
      fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
      include        fastcgi_params;
  }
}

This isn't how to use an MVC application, you should read the docs of how to use a MVC application properly https://docs.phalcon.io/hu/3.2/application#module