Question

Help me cakephp and nginx

Dear!

I’m using nginx VPS. Source cakephp code

But now I can not get vhost configuration.

My site is http://phimcucnhanh.com have successfully configured.

But I add configuration for website mobile http://m.phimcucnhanh.com not run.

I want to run in fodel http://m.phimcucnhanh.com domain name www / sites / m.phimcucnhanh.com / but I do not. It took me 2 days to do this without success. We wish your help.

Vhost.conf

<pre> server { listen 80; server_name www.phimcucnhanh.net phimcucnhanh.net www.phimcucnhanh.com; rewrite ^(.*) http://phimcucnhanh.com$1 permanent; }

server { listen 80; server_name phimcucnhanh.com;

# root directive should be global
root   /www/website/phimcucnhanh.com/app/webroot/;
index  index.php;

access_log /www/website/phimcucnhanh.com/log/access.log;
error_log /www/website/phimcucnhanh.com/log/error.log;

location / {
    try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
    try_files $uri =404;
    include /etc/nginx/fastcgi_params;
    fastcgi_pass    127.0.0.1:9000;
    fastcgi_index   index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
	#fastcgi_param SCRIPT_FILENAME /www/website/phimcucnhanh.com/app/webroot/index.php;
}

} </pre>

#WEb mobile <pre> server { listen 80; server_name m.phimcucnhanh.com;

# root directive should be global
root   /www/website/m.phimcucnhanh.com/app/webroot/;
index  index.php;

access_log /www/website/m.phimcucnhanh.com/log/m.access.log;
error_log /www/website/m.phimcucnhanh.com/log/m.error.log;

location / {
    try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
    try_files $uri =404;
    include /etc/nginx/fastcgi_params;
    fastcgi_pass    127.0.0.1:9000;
    fastcgi_index   index.php;
    #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
	fastcgi_param SCRIPT_FILENAME /www/website/m.phimcucnhanh.com/app/webroot/index.php;
}

} </pre> Thank you very much!


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

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.

This comment has been deleted

Looks like you’ve got it up and running! I see the mobile site when I visit http://m.phimcucnhanh.com Would you mind sharing what you needed to fix to help the next person who comes along?

I don’t see anything particularly wrong with those configurations. Were you seeing errors in the logs? What happened when you tried visiting the mobile site, was there an error message?