/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;
    }
}

nginx+thinkPhp配置虚拟主机和伪静态规则重写的更多相关文章

  1. Nginx下配置虚拟主机的三种方法

    Nginx下,一个server标签就是一个虚拟主机. 1.基于域名的虚拟主机,通过域名来区分虚拟主机——应用:外部网站 2.基于端口的虚拟主机,通过端口来区分虚拟主机——应用:公司内部网站,外部网站的 ...

  2. linux上nginx上配置虚拟主机的相关配置

    1.配置主配置: nginx/conf/nginx.conf 2.虚拟主机配置:nginx/conf/extra/learn.weixin.com.conf 配置完后,重启服务器!

  3. nginx下配置虚拟主机

    linux 虚拟机下配置虚拟主机 nginx.conf 文件不动, 在 conf.d 或者 conf 目录下 新建项目.conf server { listen 80; server_name loc ...

  4. Nginx如何配置虚拟主机?

    注意,该环境是依赖于http://www.php20.com/forum.php?m ... &extra=page%3D1 基础上进行配置.默认不具备这些文件 .下面是增加一个mytest点 ...

  5. nginx如何配置虚拟主机

    server { listen 80; #listen [::]:80 default_server ipv6only=on; server_name local.presion.caomall.ne ...

  6. nginx配置虚拟主机vhost的方法详解

    Nginx vhost配置,可实现基于ip.端口号.servername的虚拟主机,同时可避免直接修改主配置文件.在nginx下配置虚拟主机vhost非常方便.这篇文章主要介绍了nginx配置虚拟主机 ...

  7. TP 等框架在配置虚拟主机伪静态注意事项

    在配置虚拟主机的伪静态 .htaccess 文件时需要注意 ? 符号的添加与否处理 例如TP 框架来讲 无 ? 符号,在有的虚拟主机中必须这样配置,否则无法解析(试了多个公司的虚拟主机只要加了?符号就 ...

  8. [转]Nginx伪静态配置和常用Rewrite伪静态规则集锦

    Nginx伪静态配置和常用Rewrite伪静态规则集锦 作者: 字体:[增加 减小] 类型:转载 时间:2014-06-10 我要评论 伪静态是一种可以把文件后缀改成任何可能的一种方法,如果我想把ph ...

  9. nginx 配置虚拟主机

    文章转载自:http://www.ttlsa.com/html/1571.html 上篇说道我们的nginx是安装在/usr/local/nginx/ cd conf 我们现在把所有的虚拟主机放在一个 ...

随机推荐

  1. english & utils & tools

    english & utils & tools https://openlanguage.com/ https://www.grammarly.com/blog/email-writi ...

  2. Spring boot 搭配 JPA 生成表注释 和 字段注释

    原文地址:https://blog.csdn.net/qq_39996837/article/details/84717748 由于在数据库表反向生成过程中呢,需要通过jpa自动生成表,并且这个表必须 ...

  3. 新装mvn建第一个项目报错org.apache.maven.plugins:maven-resources-plugin:2.6

    1.第一次创建mvn项目会报maven-resources-plugin-2.6.jar错,原因是mvn无法自动下载这个jar包,多次删除这个目录下的C:\Users\Administrator\.m ...

  4. 【BZOJ2818】Gcd(莫比乌斯反演,欧拉函数)

    题意:给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的数对(x,y)有多少对 1<=N<=10^7 思路:莫比乌斯反演,同BZOJ2820…… ; ..max]of ...

  5. TOMCAT加载两次war包(重复加载)

    一.问题描述 项目中通过配置Context节点docBase,使docBase指向项目的绝对路径,可以直接通过IP加端口访问,今日发现意外bug,项目中某个功能奇数次执行成功,偶数次执行失败.二.问题 ...

  6. MyEclipse 8.5安装Aptana

    Aptana简单介绍 Aptana是一个很强大,开源,专注于JavaScript的Ajax开发IDE它的特性包含:    1.JavaScript,JavaScript函数,HTML,CSS语言的Co ...

  7. php 获取今天,本周,本月,三个月内,半年内,今年的开始和结束时间

    $now = time();         //今天        $today_audit_num = 0;        $today_use_num = 0;        $beginTim ...

  8. VBS 操作Word

    VBS 操作Word   1.新建Word文档 '使用Add方法 Dim ObjWD,ObjDOC Set ObjWD=CreateObject("Word.application" ...

  9. 【codevs1306】广播操的游戏

    求字符串内的非空子串的数量 后缀数组!!! #include<algorithm> #include<cstdlib> #include<cstring> #inc ...

  10. 【bzoj1269】[AHOI2006]文本编辑器editor

    在bzoj上乱翻,发现了可持久化并查集,然后baidu了一下,发现一种叫rope的东西.   !!!真的太爽了!!!   直接上代码,感受一下(也是蒯来的).       由于rope的底层实现,in ...