zoukankan      html  css  js  c++  java
  • ThinkPHP5 Nginx通用配置

    项目配置内容如下:

    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 www.example123.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;
        }
    }
  • 相关阅读:
    贝叶斯公式推导
    三种常量池
    SpringCloud使用Feign实现服务间通信
    springCloud配置本地配中心SpringCloudConfig
    SpringApplication执行流程
    调用shutdown.sh后出现could not contact localhost8005 tomcat may not be running报错问题
    TCP协议详解
    web.xml配置说明
    第一份offer
    博客CSS
  • 原文地址:https://www.cnblogs.com/phperlinxinlan/p/11163693.html
Copyright © 2011-2022 走看看