VPS侦探论坛

 找回密码
 注册
查看: 6600|回复: 3

请教:Dedecms织梦下如何实现泛域名自动绑定到目录呢?

[复制链接]
发表于 2014-8-12 20:52:55 | 显示全部楼层 |阅读模式

比如域名abc.lnmp.org自动绑定到该网站下的abc目录,域名efg.lnmp.org自动绑定到该网站下的efg目录,当然abc和efg是根目录了。如果是没有的话,直接是根目录的index.html。

应该是使用到重写规则吧,在wordpress多站点中这个功能是很好实现的,但是不知道在dedecms中应该如何实现?


要实现这样的功能的话,规则应该怎样写呢?


[ 本帖最后由 vieway 于 2014-8-12 21:04 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2014-8-12 21:40:44 | 显示全部楼层


www的域名和不带www的直接/root/vhost.sh添加上子域名如下:
  1. server {
  2.         listen       80;
  3.         server_name  ~^(?.+)\.lnmp\.org$;
  4.         index index.html index.htm index.php;
  5.         root   /home/wwwroot/lnmp/$subdomain;
  6.                
  7.                 #error_page   404   /404.html;
  8.                 location ~ [^/]\.php(/|$)
  9.                         {
  10.                                 # comment try_files $uri =404; to enable pathinfo
  11.                                 try_files $uri =404;
  12.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  13.                                 fastcgi_index index.php;
  14.                                 include fastcgi.conf;
  15.                                 #include pathinfo.conf;
  16.                         }

  17.                 location /nginx_status {
  18.                         stub_status on;
  19.                         access_log   off;
  20.                 }

  21.                 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  22.                         {
  23.                                 expires      30d;
  24.                         }

  25.                 location ~ .*\.(js|css)?$
  26.                         {
  27.                                 expires      12h;
  28.                         }

  29.                 access_log  off;
  30.     }
复制代码
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2015-4-7 13:45:23 | 显示全部楼层

回复 2# 的帖子


www与根域名通过/root/vhost.sh添加
然后新建这个文件 一个站通过这两个文件控制吗?
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2015-4-7 20:41:44 | 显示全部楼层

回复 3# 的帖子




可以
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-5-17 17:06 , Processed in 0.027001 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表