/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. IDA-IDC脚本编写语法

    1.IDA脚本编写基础 IDC是IDA内置的脚本语言,其语法与C非常相似,它是一种解释性语言. 执行方法 在IDA中按SHIFT+F2键会弹出一个对话框,把语句直接写在对话框中,点击run就可被运行. ...

  2. codevs4439 YJQ Requires Food

    题目描述 Description 神犇YJQ有n个不同的妹子和m种食物,每一天每一种食物只供应一个妹子吃的份量.在接下来的t天内,YJQ准备包养所有的妹子. 对于每个妹子,她在t天内都只会吃某些特定的 ...

  3. School Marks-CodeForces

    B. School Marks time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  4. JSP的会话(Session)跟踪

    以下内容引用自http://wiki.jikexueyuan.com/project/jsp/session-tracking.html: 会话(Session) HTTP是一个“无状态”协议,这意味 ...

  5. NBUT 1450 Blitzcrank

    [1450] Blitzcrank 时间限制: 1000 ms 内存限制: 65535 K 问题描写叙述 Blitzcrank is a robot. There are some pretty go ...

  6. 手把手教你开发Chrome扩展三:关于本地存储数据

    手把手教你开发chrome扩展一:开发Chrome Extenstion其实很简单 手把手教你开发Chrome扩展二:为html添加行为 手把手教你开发Chrome扩展三:关于本地存储数据 HTML5 ...

  7. Chrom开发者工具详解

    Chrome开发者工具不完全指南(一.基础功能篇) http://www.mamicode.com/info-detail-863534.html Chrome开发者工具不完全指南(二.进阶篇) ht ...

  8. REST API 安全设计

    REST API 安全设计 2017年04月27日 18:34:27 阅读数:1699   Rest API 的那些事儿 作者/ asterisk 在软件行业快速发展的今天,传统的软件授权已经不能足以 ...

  9. Java算法-奇怪的分式

    题目: 上小学的时候,小明常常自己发明新算法.一次,老师出的题目是: 1/4 乘以 8/5 小明竟然把分子拼接在一起,分母拼接在一起,答案是:18/45 老师刚想批评他.转念一想.这个答案凑巧也对啊, ...

  10. sharepoint 訪问缩略图

    Sharepoint缩略图 简单介绍 Sharepoint2010中有专门的图片库,当你新建图片库后,向图片上传一部分图片.当你浏览这个库时显示一排排小图片.当点击一个图片时进入显示的是大图.不要简单 ...