我这里安装的是宝塔面板集成的环境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. Less的guards and argument matching

    less guards/argument matching: .setbackground(@number) when (@number>0){ .setbackground( @number ...

  2. Studying TCP's Congestion Window using NS

    Studying TCP's Congestion Window using NS How to obtain TCP's CWND value The most important value th ...

  3. order by注入点利用方式分析

    漏洞分析 使用sqli-lab中的lesson-52作为测试目标.关键代码为: error_reporting(0); $id=$_GET['sort']; if(isset($id)) { //lo ...

  4. javascript 随机数 生成 n-m

    例子:生成800-1500的随机整数,包含800但不包含1500 代码如下: 1500-800 = 700 Math.random()*700 var num = Math.random()*700 ...

  5. easyui学习笔记8—在手风琴中加载其他的页面

    在手风琴中加载其他页面和在表格中加载其他的页面有写类似的,就是请求另外一个页面显示数据. 1.先看看引用的资源文件 <link rel="stylesheet" href=& ...

  6. WSDM 2014推荐系统论文

    Xiao Yu, Hao Ma, Paul Hsu, Jiawei Han On Building Entity Recommender Systems Using User Click Log an ...

  7. WebSphere集群环境修改IHS端口号的方法

    参考资料:http://wenku.baidu.com/link?url=E9BkuEjJ16i9lg7l91L0-xhKCYkHV0mAnlwAeSlDCFM4TjZyk4ZVxmUu64BGd4F ...

  8. 八.安装Nginx

    http://blog.csdn.net/grhlove123/article/details/47834673

  9. 日期时间JS插件

    首先要引入基本文件:bootstrap的基本js和css文件,因为用到了jquery所以要引入jquery文件 <script src="jquery-1.11.2.min.js&qu ...

  10. 关于mysql 出现 1264 Out of range value for column 错误的解决办法

    今天给客服恢复mysql数据的时候.本来测试好的数据.但是到了客户那里却死活不干活了.老报错! INSERT INTO ka_tan4 set num='716641385999', username ...