Hello,
i am having some trouble setting up phalcon on a vps using nginx. When using apache I can get everything to work, but on nginx I get a few errors so far. After having 404, 502, Access Denied, File not found and everything else you could imagine, I accomplished a few states:
- Site available and no errors - but all I could get to show was the testapp/app/views/index.volt
- Having 502 Bad Gateway on every site - nothing worked at all
- Having 502 Bad Gateway whenever I hit a legit site - when I open a site that's not existing I get "ExampleController handler class cannot be loaded"
At the moment I have the last state - based on an empty project made with the phalcon dev tools. Since I kind of changed all possible things, and am not sure what config servers which outcome at all anymore. First of all, here's my vhosts file, which could be the problem maybe. Tried all kinds of variants, I kind of get what's going on but seems like it's not enough.
server {
listen 80;
server_name example.com; // This is normally the right url
index index.php;
root '/home/forge/default/testapp/public';
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php$ {
try_files $uri =404;
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_pat$
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_scr$
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
error_log /var/log/nginx/default.log;
}
I've put a small file with phpinfo() inside testapp/public and can execute it properly. So I guess I have set the config in etc/php5/fpm/pool.d/www.conf correctly. (This should be everything I fiddled with)
user = www-data
group = www-data
listen = /var/run/php5-fpm.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
So I hope to find someone who can help me out of that misery, I don't wanna know how many hours I've been trying to get it working. I also tried cgi.fix_pathinfo = 0/1, makes no change so far.
Cheers, WRZ
Edit: Sorry, but the code tags seem to not work properly.. here are some pastebin links: https://pastebin.com/CQFdeFRf
DoubleEdit: I am using the latest version of phalcon and nginx - running on a DigitalOcean VPS. I've tried forge.laravel, hence the user forge... I also just checked the owner of the php5-fpm.sock, it's www-data