nginx配置 首页不显示 index.html首页是显示域名
2016-08-09 14:38
585 查看
原状况如下:
访问:www.test.com 敲回车后浏览器中自动跳转致: www.test.com/index.html
公司新需求如下:
访问:www.test.com 敲回车后浏览器中url不变,仍显示www.test.com,但是能访问到index.html页面。
配置如下:
访问:www.test.com 敲回车后浏览器中自动跳转致: www.test.com/index.html
公司新需求如下:
访问:www.test.com 敲回车后浏览器中url不变,仍显示www.test.com,但是能访问到index.html页面。
配置如下:
#以下为负载均衡设置,与题目无关 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为判断访问/目录有,匹配到该if,跳转到index配置项,即访问到index.html。 if ( !-e $request_filename ) { proxy_pass http://index; } } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } #静态文件请求location设置,与题目无关 location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ { root /home/wwwroot/index; expires 30d; } }
相关文章推荐
- 项目访问index.html,默认跳转到login.jsp页面,隐藏地址栏每次显示请求路径和参数,定个在域名不变
- nginx配置后只有根目录首页index.php能访问,其他页面404
- nginx 访问默认index.html首页跳转指定页面
- 黄聪:织梦DedeCMS如何去掉首页域名后面的index.html
- 如何隐藏dedecms网站首页网址显示的index.html
- nginx 开启GZIP、域名指向index.html
- nginx学习6——显示并发连接数,域名重定向,基于端口的配置,基于ip的配置
- java的struts2项目实现网站首页只显示域名不显示index.do的做法
- DedeCMS访问网站首页会自动在域名后面多出index.html的解决方法
- Nginx域名配置详解
- 访问 apache 显示 Forbidden You don't have permission to access /index.html on this server. 解决方法
- NGINX配置多域名
- Nginx配置域名重定向
- nginx 域名跳转 Nginx跳转自动到带www域名规则配置、nginx多域名向主域名跳转
- dedecms如何去掉首页index.html的方法
- nginx配置反向代理,域名代理后不生效问题
- Nginx配置之基于域名的虚拟主机
- Nginx配置之基于域名的虚拟主机
- Nginx 域名跳转配置
- nginx 多站点,多域名,多目录配置