server {
listen ;
#server_name localhost;
server_name hhy.com;/**这里写自己的域名*/ #charset koi8-r; #access_log logs/host.access.log main; # root "F:/PHPstudy/PHPTutorial/WWW";
root "F:/PHPstudy/PHPTutorial/WWW/ShopMall"; location / {
index index.html index.htm index.php l.php;
/**下面的if判断就是隐藏index.php*/
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$ last;
break;
}
autoindex off;
} #error_page /.html; # redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root html;
}

nginx服务器的配置文件是 nginx.conf ,注意配置文件的最后是否有加载其他配置文件

打开我的电脑,目录是C:\Windows\System32\drivers\etc下的hosts文件,在最下面加上127.0.0.1 hhy.com,添加的域名一定要跟nginx的配置文件中设置的域名一致

TP5框架 nginx服务器 配置域名 隐藏index.php的更多相关文章

  1. 一台nginx服务器多域名配置 (转)

    Nginx强大的正则表达式支持,可以使server_name的配置变得很灵活,如果你要做多用户博客,那么每个用户拥有自己的二级域名也就很容易实现了. 下面我就来说说server_name的使用吧: s ...

  2. 【nginx】一台nginx服务器多域名配置

    Nginx 多域名配置 nginx绑定多个域名可又把多个域名规则写一个配置文件里,也可又分别建立多个域名配置文件,我一般为了管理方便,每个域名建一个文件,有些同类域名也可又写在一个总的配置文件里.一. ...

  3. Nginx配置PATHINFO隐藏index.php

    1.网络来源:http://www.shouce.ren/post/view/id/1529 server {      listen       80;     default_type text/ ...

  4. Nginx服务器 配置 https

    参考 这里 1. 购买证书 2. 补全信息 3. 下载证书( .pem + .key ) 4. 上传至服务器  /usr/local/nginx/conf/cert 下 5. 修改 nginx.con ...

  5. 【Nginx】Nginx配置REWRITE隐藏index.php

    只需要在server里面加上 if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; break; }

  6. Nginx配置REWRITE隐藏index.php

    server { listen 80; server_name localhost; root D:\workspace\PHP\Atromic; location / { index index.p ...

  7. linux服务器中Apache隐藏index.php失败

    可以通过URL重写隐藏应用的入口文件index.php,下面是相关服务器的配置参考: [Apache] httpd.conf配置文件中加载了mod_rewrite.so模块 AllowOverride ...

  8. centos nginx server_name 配置域名访问规则

    今天配置Server_name时,希望禁用一些域名,应为这些域名我想让通过另外一个Server配置 server_name "~^((\w*[^w]{1}\w*)|w{1,2})\.hell ...

  9. nginx支持pathinfo并且隐藏index.php

    How To Set Nginx Support PATHINFO URL Model And Hide The /index.php/ 就像这样 The URL before setting lik ...

随机推荐

  1. 使用pyinstaller打包多个py文件为一个EXE文件

    1. 安装pyinstaller. pip install pyinstaller !!!!64位win7上打包后始终不能用,提示找不到ldap模块,换了32位win7就好了.!!!!(代码中涉及ld ...

  2. live 2d js demo

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  3. 给MS的意见

    2017-02-27 WPF的中文注释文档翻译得很烂.太多了,列举不过来. 这个是 System.Threading.Tasks.Task.Exception: 获取导致 System.Aggrega ...

  4. 【IDEA填坑】xml不编译

    今天在maven编译Springboot项目的时候,发现src/main/resources下的配置文件编译失败(就是war包中没有放入xml配置文件导致程序启动失败),经查询资料,发现新版本的IDE ...

  5. mac下idea搭建maven项目的一些问题总结

    1.关于版本 目标原版与原发行版本不一致 <build> <finalName>comment</finalName> <plugins> <pl ...

  6. 简易OA漫谈之工作流设计(四,怎么支持会签)

    会签:就是一个步骤要所有人都审批完成才能完成. 上一步提交到会签步骤时,该步骤的每个人都能收到一条待办任务, 会签审批人每次提交时都检查该步骤所有会签人是否已经审批,如果全部审批就产生下一手任务. 演 ...

  7. 12、类成员访问修饰符public/private/producted/readonly

    1.private 类的私有成员 private 类的私有成员,只能在内部访问,在外部访问不到,无法被继承,我们可以将不需要被外部修改的定义为私有的 私有成员,只能在内部访问,在外部访问不到 priv ...

  8. Spring官方文档下载

    Spring框架是目前最流行的java web开发框架,很多时候,我们需要去查看spring的官方文档,这里就简单介绍下如何下载其官方文档. 1.搜索到spring 官网并进入 2.点击DOCS 3. ...

  9. win10php环境变量配置(xampp环境)

    我的电脑--属性(右键)--高级系统设置--环境变量--系统变量--Path--编辑 新建两条变量: 一个是xampp文件下的php文件,例如 C:\xampp\php 一个是xampp文件下的php ...

  10. springboot测试的方法

    @RunWith(SpringJUnit4ClassRunner.class)@SpringBootTest( classes = {App.class})@WebAppConfigurationpu ...