Nginx virtual website directory settings

Source: Internet
Author: User
Tags parent directory phpmyadmin

Sometimes we want to install phpmyadmin and do not want to put the phpmyadmin file in the root directory of the website. We can use the virtual directory to solve this problem.

The code is as follows: Copy code

# Phpmyadmin virtual directory
Location/pma {
Alias/web/htdocs/phpmyadmin;
Index index.html index.htm index. php;
}
# Php support for virtual directories
Location ~ ^/Pma/. +. php $ {
Rewrite/pma (/. *. php ?) $1 break;
Root/web/htdocs/phpmyadmin;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Include fastcgi. conf;
}

Alias

The code is as follows: Copy code
Location/abc/
{    
Alias/home/html/abc /;
}

 

In this section, http: // test/abc/a.html specifies/home/html/abc/a.html. This configuration can also be changed

Root

The code is as follows: Copy code
Location/abc/
{    
Root/home/html /;
}

 

The/a/directory must have a hello directory; otherwise, an error is returned.
If it is not in the location command, it specifies the root object of a website.

Alias: this is an alias that defines the alias of the above file or directory
Root: specifies the parent directory of a directory, for example:
Locate/hello /{
Root//;
}
The/a/directory must have a hello directory; otherwise, an error is returned.
If it is not in the location command, it specifies the root directory of a website.

In addition, "/" must be added after the directory name when using alias.

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.