thinkphp3.2.3 + nginx 配置二级域名
使用的是阿里云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 配置二级域名的更多相关文章
- 使用nginx配置二级域名
使用nginx配置二级域名 2018.11.21 11:51:17字数 613阅读 170 最近想把三个项目配在一个服务器上,于是想使用nginx配置二级域名实现. 1.域名添加解析 我的是阿里云的域 ...
- nginx配置二级域名
我在我的服务器上面跑了两个node应用程序,分别一个端口2368跑的是ghost博客,一个端口8000跑的是我的demo程序.想要一级域名zhangruojun.com用来访问博客,二级域名demo. ...
- vue+nginx配置二级域名
[1]修改路由文件 [2]修改配置文件 [3]修改本机nginx配置文件 [4]修改服务器nginx配置文件 [5]重启nginx文件,用二级域名访问 http://192.168.199.xxx:7 ...
- 求助高手,Nginx配置二级域名跳转 地址栏不变咋处理?
做域名镜像的rewrite即可rewrite ^/(.*)$ http://二级域名/$1 last;
- nginx+tomcat+二级域名静态文件分离支持mp4视频播放配置实例
nginx+tomcat+二级域名静态文件分离支持mp4视频播放配置实例 二级域名配置 在/etc/nginx/conf.d/目录下配置二级域名同名的conf文件,路径改成对应的即可 statics. ...
- 利用nginx泛域名解析配置二级域名和多域名
利用nginx泛域名解析配置二级域名和多域名 网站的目录结构为 html ├── bbs └── www html为nginx的安装目录下默认的存放源代码的路径. bbs为论坛程序源代码路径 www为 ...
- nginx下配置二级域名指向子目录
今天终于把nginx的二级域名配置搞定了,哎之前在测试服务器上弄过一次,不过那个是在本地解析的hosts,把ip指向到域名上就ok,再在nginx.conf里改了下配置就好了,用同样的方法改了正式服务 ...
- 通过Nginx为网站配置二级域名
目录 配置域名解析 配置Nginx 重启Nginx 补充 需求:服务器上面运行多个项目:实现每个二级域名访问对应项目: 服务器:阿里云服务器:域名:阿里云注册: 配置域名解析 即配置DNS解析.一定要 ...
- Nginx配置同一个域名同时支持http与https两种方式访问
Nginx配置同一个域名http与https两种方式都可访问,证书是阿里云上免费申请的 server{listen 80;listen 443 ssl;ssl on;server_name 域名;in ...
随机推荐
- Java-多线程基本
Java-多线程基本 一 相关的概念 进程:是一个正在执行中的程序 每个进程都有一个执行的顺序,该顺序是一个执行路径,或者叫一个控制单元 线程:就是进程中的一个独立的控制单元,线程在控制着进程的执行 ...
- 将Ext JS 5应用程序导入Web项目中
相关资料:http://docs.sencha.com/extjs/5.1/getting_started/welcome_to_extjs.html 原文地址: https://blog.csdn. ...
- python yield的终极解释
(译)Python关键字yield的解释(stackoverflow): http://stackoverflow.com/questions/231767/the-python-yield-keyw ...
- supervisor配置与应用
1.简介 supervisor 是一款基于Python的进程管理工具,可以很方便的管理服务器上部署的应用程序.supervisor的功能如下: a. 启动.重启.关闭包括但不限于python进程. b ...
- 转Hibernate 一对多关联的CRUD__@ManyToOne(cascade=(CascadeType.ALL))
一:Group和Users两个类 假定一个组里有n多用户,但是一个用户只对应一个用户组. 1.所以Group对于Users是“一对多”的关联关系@OneToMany Users对于Group是“多对一 ...
- python全栈开发从入门到放弃之socket并发编程多线程GIL
一 介绍 ''' 定义: In CPython, the global interpreter lock, or GIL, is a mutex that prevents multiple nati ...
- koa2+mongoose搭建框架模型
由于学的是java,所以此框架多少有点java的影子,我觉得不必排斥语言,只要思想好,所有语言均可以通用.项目分以下几层 app.js项目启动入口,类似于main函数 controller-view层 ...
- springer论文模板参考文献的顺序问题
latex环境 MikTex 2.9 + TeXstudio 2.12.8 (+ Mendeley) 问题 springer提供的latex模板 中最后的参考文献是按照字母顺序排列的.我想要弄成按照文 ...
- 论文笔记:dropout
Improving neural networks by preventing co-adaptation of feature detectors arXiv preprint arXiv: 120 ...
- 【Linux学习】1.Linux基础知识
记录学习Linux 系统的相关知识点,欢迎大家拍砖交流,一起成长:QQ:2712192471 作者背景:前端开发工程师 | Python | web安全爱好者 一,Windows系统下 Linux 的 ...