Saturday, October 25, 2014

Re: using cakephp with nginx

I have multiple servers all running nginx and serving up Cake apps with no issues. The "official CakePHP config" from the book does in fact work because I'm currently using it in several locations. I do have configs that are quite different than the book but they are beyond the scope if simply getting Cake to work with Nginx. I have much more than many Cake apps with the Cake core residing in a central location outside of /www. Having to "config" the rewrite rule for each project is not necessary.  Save your config with a name such as 'cake_default' and with each new project simply open that config and alter server, root, and the locations of your error and access logs to correspond with your new project and save that config accordingly, such as "my_site." You should see "Welcome to Nginx" when visiting your server ip and see your project when visiting your_server_ip/project. If this is not the case, what do you see? Check your error logs for an indication of where things are going awry ... the answers to all of your problems can almost always be found there. A common problem that I see come up a lot  is with fastcgi_pass (you should have PHP running as a FastCGI instance). Many people, including myself, use fastcgi_pass   unix:/run/php5-fpm.sock; or fastcgi_pass   unix:/tmp/php5-fpm.sock; in place of fastcgi_pass   127.0.0.1:9000; Your error logs will tell you if you are having a problem in this area. Pay particular attention that your are changing "server_name" and "root" in your config with each new project. Error logs and access logs aren't as critical and can be commented out if you wish but I don't recommend it. Also, make sure you restart nginx each time you alter your configs and also make sure you are symlink'ing each new config to /nginx/sites-enabled. 

On Saturday, October 25, 2014 12:09:19 PM UTC-4, Saif Turki wrote:
thanks for your reply  
i tried the *officiel cakephp config* from the book and it doesn't work   

the problem that i have *many cakephp project* running on my dedicated
server (not only *a single project* where i have just to move the *app+lib
folder* to the *DOCUMENT_ROOT* folder exp: */home/www/*)
a cakephp project need three .htaccess file (nginx doesn't work with
.htaccess file) so i have to config the rewrite rule foreach cakephp project
manually
i want to access to my projects using this url
*my_ip_address/my_cakephp_project1*, *my_ip_address/my_cakephp_project2*
where *my_cakephp_project1*, *my_cakephp_project2* are *2 folders* on my
*DOCUMENT_ROOT*

can you give me *a sample config file* or an *alternative solution* to *run
many cakephp projects on my server using nginx* ?
thanks



--
View this message in context: http://cakephp.1045679.n5.nabble.com/using-cakephp-with-nginx-tp5719912p5719938.html
Sent from the CakePHP mailing list archive at Nabble.com.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: