使用的是阿里云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. django 密文 cookie 加密

    默认cookie是明文 # 加密cookie salt 通过这个字符串把cookie内容加密 obj.set_signed_cookie('username111','aaaa',salt=" ...

  2. python web框架 Django的APP以及目录介绍 2

    app: migrations 数据修改表结构 admin Django为我们提供的后台管理 apps 配置当前app models ORM,写指定的类 通过命令可以创建数据库结构 tests 单元测 ...

  3. wordpress 主题开发

    https://yusi123.com/3205.html https://themeshaper.com/2012/10/22/the-themeshaper-wordpress-theme-tut ...

  4. PHP 语言结构(Language constructs)和函数的区别

    相信大家经常看到对比一些PHP应用中,说用isset() 替换 strlen(),isset比strlen执行速度快等. 例子: if ( isset($username[5]) ) { // The ...

  5. ruby中的instance_eval,class_eval,eval

    ruby具有在运行时执行以字符串形式保存的代码的功能设施,eval族方法 .包括Kernel#eval,Object#instance_eval,Module#class_eval. Kernel#e ...

  6. 263. Ugly Number(判断是否是丑数 剑指offer34)

    Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers ...

  7. 2017 Multi-University Training Contest - Team 4 hdu6070 Dirt Ratio

    地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=6070 题面: Dirt Ratio Time Limit: 18000/9000 MS (Ja ...

  8. The 15th UESTC Programming Contest Preliminary J - Jermutat1on cdoj1567

    地址:http://acm.uestc.edu.cn/#/problem/show/1567 题目: Jermutat1on Time Limit: 3000/1000MS (Java/Others) ...

  9. linux meta 18.0.1 系统安装nodejs

    前置条件是:需要准备sudo apt-get 命令 第一步: 执行命令sudo apt-get install nodejs 即可安装, 之后可使用node -v 查看版本node 版本号 第二步: ...

  10. presto 0.166安装部署

    系统:linux java:jdk 8,64-bit Connector:hive 分布式,node1-3 node1:Coordinator . Discovery service node2-3: ...