使用的是阿里云centOS.74

第一步:

配置urlpath

server
{
listen ;
server_name www.xxxx.com xxxx.com; root /data/www/xxxx;
index index.php index.html index.htm; location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1
last;
}

} location ~ \.php$ {
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;

include fastcgi_params;
}
}

重启nginx

systemctl restart nginx

第二步

Application/Common/Common/Conf/config.php

<?php
return array(
'URL_CASE_INSENSITIVE' => true,
'URL_HTML_SUFFIX' => 'html',
'URL_MODEL' => 2,
'URL_ROUTER_ON' => true,//默认false, // 是否开启URL路由
'APP_SUB_DOMAIN_DEPLOY' => true, //开启二级域名
'APP_SUB_DOMAIN_RULES' => array(
'c.xxxx.com' => 'Canai', //
),
);

测试下是否可以,如果还不行

在nginx下的配置文件xxxx.conf里继续增加一个server,配置文件拥有了两个server节点


server
{
listen 80;
server_name www.xxxx.com xxxx.com; root /data/www/xxxx;
index index.php index.html index.htm; location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1
last;
}

} location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;

include fastcgi_params;
}
}
#二级域名节点
server
{
listen ;
server_name c.xxxx.com;
root /data/www/xxxx;
index index.php index.html index.htm;
location / {
index index.html index.php;
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$ last;
}
} location ~ \.php {
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_buffers 128k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info; include fastcgi_params; }
}

thinkphp3.2.3 + nginx 配置二级域名的更多相关文章

  1. 使用nginx配置二级域名

    使用nginx配置二级域名 2018.11.21 11:51:17字数 613阅读 170 最近想把三个项目配在一个服务器上,于是想使用nginx配置二级域名实现. 1.域名添加解析 我的是阿里云的域 ...

  2. nginx配置二级域名

    我在我的服务器上面跑了两个node应用程序,分别一个端口2368跑的是ghost博客,一个端口8000跑的是我的demo程序.想要一级域名zhangruojun.com用来访问博客,二级域名demo. ...

  3. vue+nginx配置二级域名

    [1]修改路由文件 [2]修改配置文件 [3]修改本机nginx配置文件 [4]修改服务器nginx配置文件 [5]重启nginx文件,用二级域名访问 http://192.168.199.xxx:7 ...

  4. 求助高手,Nginx配置二级域名跳转 地址栏不变咋处理?

      做域名镜像的rewrite即可rewrite ^/(.*)$ http://二级域名/$1 last;

  5. nginx+tomcat+二级域名静态文件分离支持mp4视频播放配置实例

    nginx+tomcat+二级域名静态文件分离支持mp4视频播放配置实例 二级域名配置 在/etc/nginx/conf.d/目录下配置二级域名同名的conf文件,路径改成对应的即可 statics. ...

  6. 利用nginx泛域名解析配置二级域名和多域名

    利用nginx泛域名解析配置二级域名和多域名 网站的目录结构为 html ├── bbs └── www html为nginx的安装目录下默认的存放源代码的路径. bbs为论坛程序源代码路径 www为 ...

  7. nginx下配置二级域名指向子目录

    今天终于把nginx的二级域名配置搞定了,哎之前在测试服务器上弄过一次,不过那个是在本地解析的hosts,把ip指向到域名上就ok,再在nginx.conf里改了下配置就好了,用同样的方法改了正式服务 ...

  8. 通过Nginx为网站配置二级域名

    目录 配置域名解析 配置Nginx 重启Nginx 补充 需求:服务器上面运行多个项目:实现每个二级域名访问对应项目: 服务器:阿里云服务器:域名:阿里云注册: 配置域名解析 即配置DNS解析.一定要 ...

  9. Nginx配置同一个域名同时支持http与https两种方式访问

    Nginx配置同一个域名http与https两种方式都可访问,证书是阿里云上免费申请的 server{listen 80;listen 443 ssl;ssl on;server_name 域名;in ...

随机推荐

  1. linux ipc/its

    linux进程间双向消息队列 server.c #include <stdio.h> #include <stdlib.h> #include <string.h> ...

  2. TP自适应

    最近又要求职了,梳理了下这两年折腾的东西,发现有个产品很可惜,都开发完了,但是没上市.中兴的一款手表,我很喜欢那个金属壳子,结实,拿在手里沉甸甸,可以用来砸核桃. 当时调TP的时候,换了几个厂家,程序 ...

  3. Kafka笔记整理(一)

    Kafka简介 消息队列(Message Queue) 消息 Message 网络中的两台计算机或者两个通讯设备之间传递的数据.例如说:文本.音乐.视频等内容. 队列 Queue 一种特殊的线性表(数 ...

  4. Linux打包压缩与安装卸载

     一.打包压缩 (1)tar:打包拆包命令 tar -cxzjvf 打包后的文件 欲打包的目录  -c:打包文件夹  -x:拆开文件夹  -z:以gzip格式压缩,默认压缩倍数为6倍  -j:以bzi ...

  5. Vim step by step

    @1: VIM中非常迷人的功能: D------->从当前位置开始删除,直到当前行结束 cw------->修改游标所在的单词,修改范围从游标位置到单词结尾. 一个替换一个用r,一个替换多 ...

  6. AngularJS 笔记系列(四)控制器和表达式

    控制器:在 Angular 中控制器是一个函数,用来向作用域中添加额外的功能.我们用它来给作用域对象设置初始状态,并添加自定义行为. 使用方法: var app = angualr.module('a ...

  7. LINQ查询中的IEnumerable<T>和IQueryable<T>

    LINQ查询方法一共提供了两种扩展方法,在System.Linq命名空间下,有两个静态类:Enumerable类,它针对继承了IEnumerable<T>接口的集合进行扩展:Queryab ...

  8. radio,checkbox,select,input text获取值,设置哪个默认选中

    11 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title& ...

  9. Java枚举类型定义方式

    public enum Method { // get请求 GET("get"), // post请求 POST("post"); private String ...

  10. java红黑树

    从这里学了一些知识点https://blog.csdn.net/sun_tttt/article/details/65445754,感谢作者