欢迎来到资源库(www.zyku.net)

PHP教程

当前位置:首页 > 网络编程 > PHP教程 > 访问文件

PHP 网站修改默认访问文件的nginx配置

时间:2017-05-28|栏目:PHP教程|点击:|我要投稿

搭建好lnmp后,有时候并不需要直接访问index.php,配置其他的默认访问文件比如index.html这时候需要配置一下nginx才能访问到你想要设置的文件

直接上代码,如下是我的配置的一份简单的nginx到php-fpm的站点,该站点默认访问目录/ecmoban/www/index.html

server {
listen 80;
location / {
root /ecmoban/www;
index index.html index.php index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
root /ecmoban/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.html;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

原文链接:http://www.cnblogs.com/huohuoblog/archive/2017/05/27/6913441.html

(资源库 www.zyku.net)

上一篇:PHP实现获取第一个中文首字母并进行排序的方法

栏    目:PHP教程

下一篇:浅谈PHP错误类型及屏蔽方法

本文标题:PHP 网站修改默认访问文件的nginx配置

本文地址:https://www.zyku.net/php/1371.html

关于我们 | 版权申明 | 寻求合作 |

重要申明:本站所有的文章、图片、评论等内容,均由网友发表或上传并维护或收集自网络,仅供个人学习交流使用,版权归原作者所有。

如有侵犯您的版权,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:95148658 | 邮箱:mb8#qq.com(#换成@)

苏ICP备2020066115号-1

本网站由提供CDN加速/云存储服务