Hi there,
I want to have
http://cake.dev/ ==> cake2 app http://cake.dev/cake3-app ==> cake3 app
This is my nginx config.
This is my nginx config
server {
listen 80;
client_max_body_size 2M;
server_name cake.dev;
root /var/virtual/cake2app/webroot;
location /cake3-app/ {
alias /var/virtual/cake3app/webroot;
}
access_log /var/log/nginx/cakephpsite.com-access.log;
include common.conf;
include cakephp.conf;
}
This is common.conf
index index.html;
location ~ /\.ht {
deny all;
}
sendfile off;
This is cakephp.conf
include php.conf;
location / {
try_files $uri $uri/ /index.php?$uri&$args;
expires max;
access_log off;
}
This is php.conf
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
}
index index.php;
the cake.dev
is correctly pointing to my cake 2 app.
I cannot get cake.dev/cake3-app to point to the cake 3 app.
Inside my cake 3 app, I have a users/login
action which works perfectly if I access the cake 3 from a separate domain.
But that is not what I want.
What have I done wrong in terms of the nginx config?
My error is consistently a 403 if I access cake.dev/cake3-app/
and I get a cake error message telling me there is no such controller when I access cake.dev/cake3-app
.
Please advise.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
There are 3 steps. First 2 are nginx-related. Last one is cakephp-related.
Step 1: Need to inform the config responsible for server_name http://cake.dev to redirect http://cake.dev/cake3 urls to the right config
Assuming
cakedev.conf
is the config responsible forhttp://cake.dev
Notice how I write the
proxy_pass
? It goes to127.0.0.1:83
. This is crucial though I suspect you can change the port number.Step 2: Write up the config responsible for cake3
Assuming the file is cake3.conf
Notice how the server_name and the listen matches with the proxy_pass from the earlier config? This is crucial.
Step 3: Change the
App.base
inside cake3Go inside your cake 3 app and look for config/app.php
Change this value
to
This comment has been deleted