Report this

What is the reason for this report?

Help me cakephp and nginx

Posted on June 16, 2014

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!



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.

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?

This comment has been deleted

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.