zoukankan      html  css  js  c++  java
  • nginx+thinkPhp配置虚拟主机和伪静态规则重写

    /usr/local/nginx/conf/nginx.conf

    进行配置

    server
        {
            listen 80 default_server;
            #listen [::]:80 default_server ipv6only=on;
            server_name _;
            index index.html index.htm index.php;
            root  /home/wwwroot/default/duozhuan_cal_new;
            include  thinkphp.conf;
            #error_page   404   /404.html;

            # Deny access to PHP files in specific directory
            #location ~ /(wp-content|uploads|wp-includes|images)/.*.php$ { deny all; }

            include enable-php.conf;

            location /nginx_status
            {
                stub_status on;
                access_log   off;
            }

            location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
            {
                expires      30d;
            }

            location ~ .*.(js|css)?$
            {
                expires      12h;
            }

            location ~ /.well-known {
                allow all;
            }

            location ~ /.
            {
                deny all;
            }

            access_log  /home/wwwlogs/access.log;
        }
    include vhost/*.conf;

    vhost下面的

    server
        {
            listen 80;
            #listen [::]:80;
            server_name www.ma1.com ;
            index index.html index.htm index.php default.html default.htm default.php;
            root  /home/wwwroot/www;

       include  thinkphp.conf;

            include other.conf;
            #error_page   404   /404.html;

            # Deny access to PHP files in specific directory
            #location ~ /(wp-content|uploads|wp-includes|images)/.*.php$ { deny all; }

            include enable-php.conf;

            location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
            {
                expires      30d;
            }

            location ~ .*.(js|css)?$
            {
                expires      12h;
            }

            location ~ /.well-known {
                allow all;
            }

            location ~ /.
            {
                deny all;
            }

            access_log  /home/wwwlogs/y.log;
        }

    这是thinkphp.conf,这是nginx的路由重写规则

    location / {
        if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php?s=/$1 last;
            break;
        }
    }

  • 相关阅读:
    javascript深入理解js闭包
    js数组与字符串的相互转换方法
    js 将json字符串转换为json对象的方法解析-转
    js、匿名函数、闭包、回调函数
    $.ajax()方法详解
    typeof操作符返回一个字符串,表示未经计算的操作数的类型。
    【转】mysql中文乱码的一点理解
    【转】国外程序员整理的 C++ 资源大全
    【转】CC++代码优化的27个建议
    一起学JUCE之HashMap
  • 原文地址:https://www.cnblogs.com/matengfei123/p/7724233.html
Copyright © 2011-2022 走看看