这里有新鲜出炉的 Nginx 开发从入门到精通,程序狗速度看过来!
Nginx 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一个公开版本 0.1.0 发布于 2004 年 10 月 4 日。其将源代码以类 BSD 许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名。
这篇文章主要介绍了 PHP 网站修改默认访问文件的 nginx 配置, 需要的朋友可以参考下
搭建好 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;
- }
- }
以上所述是小编给大家介绍的 PHP 网站修改默认访问文件的 nginx 配置,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 PHPERZ 网站的支持!
来源: http://www.phperz.com/article/17/0809/339685.html