最近项目用的是nginx服务,apache怎么隐藏入口不赘述,官方文档有介绍,Nginx隐藏官方文档这样说的:

实践中,这样是不对的,应该在网站对应的vhost.conf中配置:

server {
listen 80;
server_name test.aaa.com;
root "D:/phpstudy_pro/WWW/test.aaa.com/public";
location / {
index index.php index.html error/index.html;
error_page 400 /error/400.html;
error_page 403 /error/403.html;
error_page 404 /error/404.html;
error_page 501 /error/501.html;
error_page 502 /error/502.html;
error_page 503 /error/503.html;
error_page 504 /error/504.html;
error_page 505 /error/505.html;
error_page 506 /error/506.html;
error_page 507 /error/507.html;
error_page 509 /error/509.html;
error_page 510 /error/510.html;
autoindex off;
if (!-e $request_filename){
rewrite ^(.*)$
/index.php?s=/$1 last;
}
} location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}

  重点是加上这一行:

    

   if (!-e $request_filename){
rewrite ^(.*)$
/index.php?s=/$1 last;
}

  

关于nginx隐藏index.php入口文件注意事项的更多相关文章

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

    这篇文章仅仅是操作,解释说明部分待更新. 1. 修改nginx的配置文件(我的配置文件在/etc/nginx/nginx.conf) [root@xxx ~]# find / -name nginx. ...

  2. thinkphp5.0如何隐藏index.php入口文件

    隐藏入口文件 public/index.php 同级的.htaccess文件 [ Apache ] 方法1: <IfModule mod_rewrite.c> Options +Follo ...

  3. CI 框架 隐藏index.php 入口文件 和 设置访问application下子目录

    1.隐藏根目录下 index.php, 在根目录下创建 .htaccess文件 内容如下: <IfModule mod_rewrite.c> RewriteEngine on Rewrit ...

  4. tp5无法隐藏index.php入口文件

    一: 官方文件: <IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine on Rewrite ...

  5. index.php入口文件至根目录

      登录|注册       咖啡如同生活的专栏 从不羡慕别人的优秀,因为相信自己也可以优秀. 闲下来时看看书,书本里的故事,总有你学到的人生.       目录视图 摘要视图 订阅 异步赠书:9月重磅 ...

  6. Nginx隐藏index.php和配置vhost

    nginx启动命令 启动:nginx停止:nginx -s stop退出:nginx -s quit重启:nginx -s reopen重新加载:nginx -s reload平滑启动:kill -H ...

  7. nginx 隐藏 index.php 和 开启 pathinfo 模式的配置

    nginx 通过 location 的规则匹配将 php 转发给 php-fpm 处理后获取结果然后返回给客户端,转发模式可以通过 unix sock 或 tcp socket 方式.百度了好多文章我 ...

  8. nginx 隐藏 index.php

    使用情景如下: 在访问 http://php.cc/Att/AttList 的时候.跳转到 http://php.cc/index.php/Att/AttList : 也就是开启重写功能: 在ngin ...

  9. ThinkPHP中通过URL重写隐藏应用的入口文件index.php的相关服务器的配置

    [ Apache ] 将httpd.conf配置文件中mod_rewrite.so所在行前面的‘#’去掉 AllowOverride None 将None改为 All 效果图

  10. nginx 隐藏index.php 并开启rewrite日志调试(apache也有)

    开启rewrite 日志 error_log       /data/log/nginx/error.log notice; 位于最外层,大约在文件的前几行 再在http{}括号里增加一行:rewri ...

随机推荐

  1. 1888: 生成括号(等级考试3级 2021-09 T5)

    题目: 程序: #include<bits/stdc++.h> using namespace std; int n; string s1; void dfs(int l,int r) { ...

  2. Vue 3项目如何设置全局变量

  3. 如何完美运行黑苹果 macOS Catalina

    2018年年初,我在闲鱼 APP 上,以799元的价格,购买了一台二手的联想 ThinkPad 11e 笔记本电脑.这是一台美版的教育用途电脑,成色较新,根据自带硬盘记录,该电脑使用时长仅有230+小 ...

  4. Hyperledger Fabric部署与测试(Ubuntu)

    Fabric部署与测试 Fabric部署与测试最正确的还是参照官方链接:Hyperledger Fabric官方链接 ok,接下来开始部署Fabric.(以Ubuntu为例) 一.部署Fabric 1 ...

  5. Appium自动化(一)-window环境搭建详细教程

    一.软件环境所需要运用的工具 1.JAVA1.8.1以上环境 2.AndroidSDK 3.Appium Desktop(appium servers) 4.Appium Client 5.Appiu ...

  6. 【NOIP2012提高组】开车旅行

    题目 到处都有 闲话 碰巧考场上出了 \(Noip\) 原题 然后这题自然而然想到 预处理一个点开始分别由 \(A,B\) 驾驶会走到的下一个点 然后用预处理的数组求答案 当然你会发现 \(X=X0\ ...

  7. Python arcpy创建栅格、批量拼接栅格

      本文介绍基于Python语言arcpy模块,实现栅格影像图层建立与多幅遥感影像数据批量拼接(Mosaic)的操作.   首先,相关操作所需具体代码如下: import os import arcp ...

  8. 斐讯K2刷华硕固件教程

    转载博客园J'KYO: https://www.cnblogs.com/pejsidney/p/12361234.html

  9. 微信小程序之permission字段

    最近查看我发布的小程序出了问题,没有显示天气,打开文件查看,出现如下提示 那么如何解决呢 在 app.json 里面增加 permission 属性配置然后在app.json中添加代码 整个app.j ...

  10. MyBatis-Plus通用Iservice 方法详解

    public interface IService<T> { /** * 默认批次提交数量 */ int DEFAULT_BATCH_SIZE = 1000; /** * 插入一条记录(选 ...