Nginx Configuration homepage does not display index.html home is the display domain name

Source: Internet
Author: User

The original situation is as follows:

Access: Www.test.com hit enter after the browser automatically jump to: www.test.com/index.html

The company's new requirements are as follows:

Access: www.test.com After hitting enter the browser URL is not changed, still display www.test.com, but can access to index.html page.

The configuration is as follows:

#以下为负载均衡设置, unrelated to the topic upstream index {server 123.159.147.369:7069 weight=20 max_fails=2 fail_timeout=30s;                Ip_hash;        } #以下为server站点设置server {Listen 80;        server_name www.test.com;        Root/home/wwwroot/index;                        Location/{index index.html index.htm;                        Proxy_set_header HOST $host;                        Proxy_set_header X-real-ip $remote _addr;                Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for; #此if为判断访问/directory has, matches to the if, jumps to the index configuration item, that is, access to index.html.                if (!-e $request _filename) {Proxy_pass http://index;         }} error_page 502 503 504/50x.html;        Location =/50x.html {root/usr/share/nginx/html; } #静态文件请求location设置, not related to the topic location ~. *\.                (HTML|HTM|GIF|JPG|JPEG|BMP|PNG|ICO|TXT|JS|CSS) $ {root/home/wwwroot/index; Expires 30d; }}

Nginx Configuration homepage does not display index.html home is the display domain name

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.