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. Nginx启动,证书报错SSL_CTX_use_PrivateKey_file.....

    报错nginx: [emerg] SSL_CTX_use_PrivateKey_file("/etc/nginx/ssl/myxxxxgame201904.key") failed ...

  2. jdbc、jpa、spring data jpa、hibernate、mybatis之间的关系及区别

    基础概念 jdbc(Java DataBase Connectivity)是java连接数据库操作的原生接口.JDBC对Java程序员而言是API,对实现与数据库连接的服务提供商而言是接口模型.作为A ...

  3. JAVA入门[23]-SpringBoot配置Swagger2

    一.新建SpringBoot站点 1.新建module,然后引入pom依赖: <parent> <groupId>org.springframework.boot</gr ...

  4. day1 登录

    #!/usr/bin/env python #Author:windtalker import os, getpass import sqlite3 from time import ctime pr ...

  5. Python_Mix*生成器,生成器函数,推导式,生成器表达式

    生成器: 生成器的本质就是迭代器 生成器一般由生成器函数或者生成器表达式来创建,其实就是手写的迭代器 def func(): print('abc') yield 222 #由于函数中有了yield ...

  6. python学习------socket编程

    一 客户端/服务器架构 1.硬件C/S架构(打印机) 2.软件C/S架构 互联网中处处是C/S架构 如黄色网站是服务端,你的浏览器是客户端(B/S架构也是C/S架构的一种) 腾讯作为服务端为你提供视频 ...

  7. tensorflow安装排坑笔记

    由于项目需求,得用tensorflow完成,只能将mxnet的学习先放在一边,开始用tensorflow,废话不多说 首先安装anaconda+vs2015+cuda8.0+cudnn6.0 首先安装 ...

  8. 总结AWS使用要点

    最近做毕业设计,要用AWS跑代码,以前只用过一次,这次踩了很多坑,记录一下.. AWS命令行管理S3 bucket AWS官方文档: http://docs.amazonaws.cn/cli/late ...

  9. docker 下安装gitlab

    1.找到docker镜像 docker search gitlab 2.下载gitlab镜像 docker pull  gitlab/gitlab-ce/ 3.通常会将 GitLab 的配置 (etc ...

  10. 电脑小白和ta的小白电脑——MySQL的简单使用

    数据库的基本操作:增删改查 分别使用cmd环境和Navicat可视化工具连接MySQL数据库来实现 这里默认了已经安装和配置MySQL↓ https://www.cnblogs.com/gifted3 ...