server {listen 80;#server_name localhost;server_name hhy.com;/**这里写自己的域名*/#charset koi8-r;#access_log logs/host.access.log main;# root F:/PHPstudy/PHPTutorial/WWW;root F:/PH...

server { listen 80; #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=/$1 last; break; } autoindex off; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /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


基础教程推荐
猜你喜欢
- laravel model模型定义实现开启自动管理时间created_at,updated_at 2023-03-02
- thinkPHP3.2.2框架行为扩展及demo示例 2022-11-07
- TP5(thinkPHP5框架)基于bootstrap实现的单图上传插件用法示例 2023-01-19
- PHP数据加密方式梳理介绍 2023-07-03
- TP5 连接多个数据库及使用方法 2023-08-30
- PHP删除数组中指定值的元素常用方法实例分析【4种方法】 2022-11-12
- PHP使用SMTP邮件服务器发送邮件示例 2022-11-16
- PHP实现创建一个RPC服务操作示例 2023-04-01
- PHP实现生成数据字典功能示例 2022-10-18
- php中使用array_filter()函数过滤数组实例讲解 2023-05-19