nginx 隐藏index.php 路径path化

server {

listen       80 default;

server_name  _;

index index.html index.htm index.php;

#root /alidata/www/default;

root /alidata/www/sandbox_pro/sandbox;

#rewrite ^/box/list   /index.php?r=box/list ;

#rewrite ^/(.*)$   /index.php?r=$1 ;

if ( -f  $request_filename/index.php) {

rewrite (.*) $1/index.php;

}

if ( !-f $request_filename )  {

rewrite (.*) /index.php;

}

location ~ .*\.(php|php5)?$

{

fastcgi_pass  127.0.0.1:9000;

fastcgi_index index.php;

include fastcgi.conf;

}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

{

expires 30d;

}

location ~ .*\.(js|css)?$

{

expires 1h;

}

时间: 2024-07-30 06:39:07

nginx 隐藏index.php 路径path化的相关文章

nginx 隐藏index.php 并开启rewrite日志调试

开启rewrite 日志 error_log       /data/log/nginx/error.log notice; 位于最外层,大约在文件的前几行 再在http{}括号里增加一行:rewrite_log on; 重写的日志将写入/data/log/nginx/error.log 关键代码 在http{ server{ location {#代码处} }}里写代码 location / { if ( !-e $request_filename ) { rewrite ^/(.*)$ /i

nginx 隐藏index.html

公司原有的需求是敲域名后自动跳转到index.html页面,其它的动态页面全部转发到后面tomcat处进行解析,并且浏览器的地址也添加了index.html,如: 访问:www.test.com 敲回车后浏览器中自动跳转致: www.test.com/index.html 今天公司提出一个新的需求,如: 访问:www.test.com 敲回车后浏览器中url不变,配置如下: upstream index { server 123.159.147.369:7069  weight=20 max_f

nginx 404页面处理以及pathInfo和隐藏index.php总述

今天开发公司官网:http://www.zstime.com/,遇到一个问题,如何在nginx下设置pathInfo以及如何隐藏index.php 这里分别来讲解一下: 一.隐藏index.php 隐藏index.php需要修改nginx的配置文件,如果你是使用vhost的,需要修改如conf/vhost/你的文件名.conf 文件,整个文件如下 server { listen 80; server_name www.zstime.com; index index index.html inde

nginx服务器绑定多个域名、支持pathinfo路由、隐藏index.php入口文件

这篇文章仅仅是操作,解释说明部分待更新. 1. 修改nginx的配置文件(我的配置文件在/etc/nginx/nginx.conf) [[email protected] ~]# find / -name nginx.conf [[email protected] ~]# vim /etc/nginx/nginx.conf nginx.conf配置文件的大致结构: ... http{ server{ ... #一个server结构可以对应一个域名 } include vhosts/*.conf

Nginx配置PATHINFO隐藏index.php

1.网络来源:http://www.shouce.ren/post/view/id/1529 server {      listen       80;     default_type text/plain;     root /var/www/html;     index index.php index.htm index.html; #隐藏index.php     location / {           if (!-e $request_filename) {         

Nginx隐藏版本号

Nginx隐藏版本号 在生产环境中,需要隐藏Nginx的版本号,以避免安全漏洞的泄露 查看方法 使用fiddler工具在Windows客户端查看Nginx版本号 在centos系统中使用"curl -I 网址" 命令查看 Nginx隐藏版本号的方法 修改配置文件法 修改源码法 一,安装Nginx 1,在Linux上使用远程共享获取文件并挂载到mnt目录下 [[email protected] ~]# smbclient -L //192.168.100.3/ ##远程共享访问 Ente

Yii2简单地址美化并隐藏index.php

目的:我只想去掉浏览器地址栏中的index.php?r=这一块. 在/config/web.php中 ’components'=>[] 中添加如下代码: 1 'urlManager' => [ 2 'enablePrettyUrl' => true, 3 'showScriptName' => false,//隐藏index.php 4 //'enableStrictParsing' => false, 5 'suffix' => '.html',//后缀,如果设置了此

[转]ThinkPHP5 隐藏index.php问题

ThinkPHP5 隐藏index.php问题 Apache,修改.htaccess文件 ----------------------------------------------------- RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]变成RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L] Nginx,修改配置文件nginx.conf ----------------------------------------

Ubuntu下配置ThinkPHP隐藏index.php

http://doc.thinkphp.cn/manual/url_rewrite.html 以上连接为框架手册提供的步骤,而Ubuntu下apache环境与windows及其它Linux有一定区别 1.开启mod_rewrite.so模块 使用sudo a2enmod,可配置模块管理,再输入rewrite,则开启了mod_rewrite.so模块. 2.AllowOverride 改为All sudo vim /etc/apache2/apache2.conf,开启找到AllowOverrid