How can I set the nginx location to match the frontend and backend addresses?

Source: Internet
Author: User
My configuration: {code...} is now available at the front end, but the background is not correct. I use the yii2 framework. When {code...} is not added before, the front-end homepage will become a download page. Now I want to match the url into the background and I don't know how to do it. Now I go to the background www. xxx. combackend to display 404, new... My Configuration:

server {listen      80;server_name     www.xxx.com xxx.com;# server_name_in_redirect off;root  /alidata/www/default/yooao/frontend/web;location ~ \.php$ {        fastcgi_pass   127.0.0.1:9000;        fastcgi_index  index.php;        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;        include        fastcgi_params;   }location / {index index.php ;root  /alidata/www/default/yooao/frontend/web;}location ~ ^/backend$ {index index.php ;root  /alidata/www/default/yooao/backend/web;}}

I can go to the front-end, but the back-end is incorrect. I use the yii2 framework. Not added before

`location ~ \.php$ {        fastcgi_pass   127.0.0.1:9000;        fastcgi_index  index.php;        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;        include        fastcgi_params;   }`

When the front-end homepage is changed to a download page. Now I want to match the url into the background and I don't know how to do it. Now I am going to the background for www.xxx.com/backenddisplay.

Reply content:

My Configuration:

server {listen      80;server_name     www.xxx.com xxx.com;# server_name_in_redirect off;root  /alidata/www/default/yooao/frontend/web;location ~ \.php$ {        fastcgi_pass   127.0.0.1:9000;        fastcgi_index  index.php;        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;        include        fastcgi_params;   }location / {index index.php ;root  /alidata/www/default/yooao/frontend/web;}location ~ ^/backend$ {index index.php ;root  /alidata/www/default/yooao/backend/web;}}

I can go to the front-end, but the back-end is incorrect. I use the yii2 framework. Not added before

`location ~ \.php$ {        fastcgi_pass   127.0.0.1:9000;        fastcgi_index  index.php;        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;        include        fastcgi_params;   }`

When the front-end homepage is changed to a download page. Now I want to match the url into the background and I don't know how to do it. Now I am going to the background for www.xxx.com/backenddisplay.

  1. Official documentation clearly shows how to configure nginx, address is: http://www.getyii.com/doc-2.0/guide/start-installation.html#nginx

  2. If you are using the pro edition, after the project Initialization is complete, frontend and backend must be configured separately, that is, two vhosts must be configured.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.