Nginx location How to set the match before and after the address?

Source: Internet
Author: User
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;}}

Now is the front desk can go in, backstage but not, I use is yii2 frame. I didn't add it 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 you enter the front page will become the download page. Now I want to match the URL into the background do not know what to do, and now into the background www.xxx.com/backend display 404, novice seeking advice

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;}}

Now is the front desk can go in, backstage but not, I use is yii2 frame. I didn't add it 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 you enter the front page will become the download page. Now I want to match the URL into the background do not know what to do, and now into the background www.xxx.com/backend display 404, novice seeking advice

    1. The official website document explicitly gives how to configure Nginx, the address is: Http://www.getyii.com/doc-2.0/guide/start-installation.html#nginx

    2. If you are using the premium version, after the project is initialized, Frontend,backend needs to be configured separately, that is, to configure two Vhost

  • Related Article

    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.