Nginx configuration problems

Source: Internet
Author: User
{Code...} for example, nginx has the above configuration. assume that the domain name is a.com. So when I upload a.comadminindex.html, nginx will load this static html: aaadistadminindex.html in this directory. now, if I want to use the url after admin...
location /admin/ {            root   /aaa/dist;            index  index.html;        }

For example, nginx has the above configuration. assume that the domain name is a.com.
When I access a.com/admin/index.html, nginxwill go to this directory to see this static HTML:/aaa/dist/admin/index.html
If I want to use/admin/How should I configure static files? This is what I want to match./admin/Partially, do not appear in the path when searching for static files, for example, the above url, a.com/admin/index.html. I hope nginxcan directly find the next url in the rootdirectory/aaa/dist/index.htmlHow should we configure it?

Reply content:
location /admin/ {            root   /aaa/dist;            index  index.html;        }

For example, nginx has the above configuration. assume that the domain name is a.com.
When I access a.com/admin/index.html, nginxwill go to this directory to see this static HTML:/aaa/dist/admin/index.html
If I want to use/admin/How should I configure static files? This is what I want to match./admin/Partially, do not appear in the path when searching for static files, for example, the above url, a.com/admin/index.html. I hope nginxcan directly find the next url in the rootdirectory/aaa/dist/index.htmlHow should we configure it?

Change root to alias.
Alias/aaa/dist /;

The simplest way is/aaa/dist/admin/index.htmlMake a soft connection/aaa/dist/index.html

Server {

    listen          80;    server_name     demo.test.com;    index           index.php index.html;    root            /mnt/hgfs/leyvi/demo.test.com/pubilc;    location ~.*\.(php)?$    {            fastcgi_pass    127.0.0.1:9000;            fastcgi_index   index.php;            include         fastcgi.conf;    }

}

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.