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 balde模板文件中判断数据为空方法 2023-08-30
- PHP实现微信支付(jsapi支付)流程步骤详解 2022-10-09
- laravel通用化的CURD的实现 2023-03-17
- php微信公众号开发之秒杀 2022-11-23
- 用nohup命令实现PHP的多进程 2023-09-02
- PHP中PDO事务处理操作示例 2022-10-15
- laravel实现按月或天或小时统计mysql数据的方法 2023-02-22
- PHP仿tp实现mvc框架基本设计思路与实现方法分析 2022-10-18
- PHP简单实现二维数组的矩阵转置操作示例 2022-10-02
- windows下9款一键快速搭建PHP本地运行环境的好工具(含php7.0环境) 2023-09-02
