栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP

Nginx TP5环境配置

PHP 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Nginx TP5环境配置

Nginx配置(tp5.conf)

> Nginx中,对php的支持没有Apache中那么友好(配置简单),需要配置很多的东西,一不小心就会很错,下面我整理了一份通用的nginx tp5配置文件:

server {
    #配置监听端口
    listen 80;
    listen [::]:80;
    #设置网站根目录作为变量root
    set $root /var/www/web;
    #设置网站根目录
    root $root; 
    #设置访问日志存放路径
    #access_log logs/access.log;
    #设置错误日志存放路径
    #error_log  logs/error.log;
    #设置网站默认首页
    index index.html index.php;
    #设置域名
    server_name example.ilxqx.com;
    #设置字符集
    charset utf-8;

    #此配置用于静态文件配置
    #location /static {
 #try_files $uri $uri/ =404;
    #}

    #配置PHP的重写规则
    location / {
 #开启目录浏览功能
 #autoindex on;
 #关闭详细文件大小统计,让文件大小显示MB,GB单位,默认为b
 #autoindex_exact_size on;
 #开启以服务器本地时区显示文件修改日期
 #autoindex_localtime on;
 if ( !-e $request_filename) {
     rewrite ^/(.*)$ /index.php/$1 last;
     break;
 } 
    }

    #配置PHP的pathinfo
    location ~ .+.php($|/) {
 fastcgi_pass 127.0.0.1:9000;
 fastcgi_index index.php;
 fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
 fastcgi_param PATH_INFO $fastcgi_path_info;
 fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
 fastcgi_param script_FILENAME $root$fastcgi_script_name;
 include fastcgi_params;
 include snippets/fastcgi-php.conf;
    }
}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/227016.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号