我这里安装的是宝塔面板集成的环境WNMP,官网上虽然也有,但是写的并不明确,对我这种用YII的新手来说也很头疼,折腾了半天终于弄好,记录一下。

首先解析一个子域名:back.domain.com;

用宝塔面板创建了一个网站,domain.com;

找到Nginx的配置文件夹  conf/vhost,此文夹中已然存在了一个domain.com.conf 文件,复制一份,重命名为back.domain.com.conf;

domain.com.conf 代码:

#START-SITE
server {
listen 80;
server_name yii.com;
access_log logs/yii.com.access.log;
root D:/wwwroot/yii;
index index.php default.php index.html index.htm default.html default.htm; include rewrite/yii.com.conf; location ~ \.php$ {
root D:/wwwroot/yii;
fastcgi_pass 127.0.0.1:4570;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
} }
#END-SITE

参照YII官网上的介绍https://github.com/yiisoft/yii2-app-advanced/blob/master/docs/guide-zh-CN/start-installation.md,简单的修改一下,修改后的 back.domain.com.conf 文件代码

#START-SITE
server {
charset utf-8;
client_max_body_size 128M; listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6 server_name back.yii.com; ##前台域名
root D:/wwwroot/yii/backend/web; ##这是前台index地址
index index.php; #access_log D:/wwwroot/yii/access.backend.log main;
#error_log D:/wwwroot/yii//error.backend.log; location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php?$args;
} location ~ \.php$ {
root D:/wwwroot/yii/backend/web;
fastcgi_pass 127.0.0.1:4570;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#error_page 404 /404.html; location ~ /\.(ht|svn|git) {
deny all;
}
}
#END-SITE

yii 后台配置独立子域名方法的更多相关文章

  1. 添加Godaddy二级域名子域名方法

    我们在申请注册了Godaddy域名后,如果需要开通二级域名,方法简单只需要在Godaddy添加二级域名(子域名)只要在域名管理后台添加A记录或CNAME别名(Aliases)即可.但我们如果需要添加二 ...

  2. Laravel 5 中间件、路由群组、子域名路由、 权限控制的基本使用方法

    创建控制器: php artisan make:controller Admin/IndexController 创建Middleware: php artisan make:middleware T ...

  3. Nginx子域名配置

    extends:http://blog.csdn.net/xiaoping0915/article/details/53899465 ,http://www.myhack58.com/Article/ ...

  4. Nginx server name配置子域名二级域名

    绑定子域名到不同目录(子站) 网站的目录结构为 /var/www/html: ├── fx └── blog└── photo html为nginx的默认网站目录. sudo vi /etc/ngin ...

  5. Flask02 路由的书写、蓝图、利用蓝图实现url前缀、利用蓝图实现子域名、访问静态文件

    1 书写路由的两种方法 1.1 利用Flask实例对象的 add_url_rule 方法实现 该方法有一个必填参数,两个默认参数 · rule : 请求路径的规则 endpoint : 端点,默认值是 ...

  6. 浅谈ThinkPHP3.2的子域名部署和路由优化(一)

    前言:建立一个网站系统,往往包含多个子网站,例如PC官网,移动端官网,后台管理,数据源自一个相同的数据库,整个架构上,从ThinkPHP来看,可以大体理解为Model(M)是一样的,Controlle ...

  7. 将子域名请求路由到MVC区域

    写了个扩展,分享给需要的朋友. 0x01 使用方法 在mvc区域中的{xxxx}AreaRegistration.cs文件中,如ProjectsAreaRegistration.cs <pre& ...

  8. [原创]K8Cscan插件之C段旁站扫描\子域名扫描

    [原创]K8 Cscan 大型内网渗透自定义扫描器 https://www.cnblogs.com/k8gege/p/10519321.html Cscan简介:何为自定义扫描器?其实也是插件化,但C ...

  9. 配置独立于系统的PYTHON环境

    配置独立于系统的PYTHON环境 python 当前用户包 一种解决方案是在利用本机的python环境的基础上,将python的包安装在当前user的.local文件夹下 一共有两种方式来实现pip的 ...

随机推荐

  1. QT开发(二) windows下简单部署

    如果使用vs编译器 需要c runtime 例如(msvc110 )这种 还需要若干qt的dll 基本在qt的bin目录 如果使用了QWindow这种对象还需要引用qt目录 plugins下 的内容 ...

  2. Windows下将jar包封装成服务程序

    1 准备 使用工具Procrun(http://commons.apache.org/proper/commons-daemon/procrun.html),下载地址(http://archive.a ...

  3. Tomcat的运行模式

    tomcat的三种运行模式 tomcat Tomcat Connector的三种不同的运行模式性能相差很大,有人测试过的结果如下:  这三种模式的不同之处如下: ●BIO:  一个线程处理一个请求.缺 ...

  4. jq扩展

    方法一(不常用)$.myjq = function(){alert("hello myjQuery);}方法二声明:$.fn.myjq=function(){$(this).text(&qu ...

  5. Oracle案例04——TNS-12547: TNS:lost contact

    Oracle数据库服务器DG从库重启后,无法完成数据同步,具体报错信息如下: 一.报错信息 alter log报错 ****************************************** ...

  6. Fatal error: Call to undefined function fnmatch() 解决

    我的PHP版本是5.6.30,linux 是CentOS 6.6,nginx,也不知啥问题,看了官方: https://secure.php.net/manual/en/function.fnmatc ...

  7. Mac终端下 连接 ubuntu 16.04 ssh root@*.*.*.* permission denied 问题解决方案

    默认 Ubuntu 不开启 ssh 服务 (1)检查是否开启SSH服务  命令:ps -e|grep ssh  查看SSH服务是否开启,或者通过命令:service sshd status 可以查看某 ...

  8. linux-记录

    查看运行的进程  ps -aux|grep java 找到要删除的进程的编号 杀死进程  kill -9 1883(进程编号) 重启服务 sh satrtBussinessService.sh

  9. NGUI UILabel文字宽度和 UITweener

    做个记录 方便别人和自己以后查找. NGUI UILabel   文字宽度 高度 mLabel.GetComponent<UILabel>().getLabWidth()   mLabel ...

  10. 使用Fragment实现Tab效果

    在上一篇中,我们将了使用ViewPager实现Tab效果.如果没有阅读过,可以点击下面的地址: http://www.cnblogs.com/fuly550871915/p/4849893.html ...