美文网首页
多端口实现多站点的方法

多端口实现多站点的方法

作者: LienZzzz | 来源:发表于2017-01-04 01:23 被阅读60次

前言

之前已经在多网站搭建中用多域名的方式实现了多网站的搭建,这次简单记录下在没有域名时,使用多端口实现多站点搭建的办法

环境

  • Ubuntu 12.04 LTS
  • PHP
  • Apache2
  • Mysql

需求

文件目录
  • Wordpress:site.com/public
  • discuz: bbs/public
端口
  • Wordpress: ip:8080
  • discuz: ip:80

实现

配置文件在 /etc/apache2

ports.conf

NameVirtualHost *:80
Listen 80
Listen 8080
  • NameVirtualHost:指定服务器IP地址(和可能的端口)来使主机接受请求
  • * 表示任一服务器IP
  • 开启对8080端口的侦听

./sites-available/site.com.conf

wordpress 虚拟主机配置文件

<VirtualHost *:8080>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin email
  ServerName  blog#没有域名,随便填
  ServerAlias blog#同上

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /home/user/public/site.com/public

  # Log file locations
  LogLevel warn
  ErrorLog  /home/user/public/site.com/log/error.log
  CustomLog /home/user/public/site.com/log/access.log combined
</VirtualHost>
  • DocumentRoot:wordpress存放目录
  • 以8080端口的请求使用此配置文件

./sites-available/bbs.conf
bbs 虚拟主机配置文件

<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin email
  ServerName  bbs
  ServerAlias bbs

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /home/user/public/bbs/public

  # Log file locations
  LogLevel warn
  ErrorLog  /home/user/public/bbs/log/error.log
  CustomLog /home/user/public/bbs/log/access.log combined
</VirtualHost>

wordpress更改默认端口
在wordpress的后台中,在General Settings里,将网站url加上端口8080

小tips

  • 之前修改端口配置后,怎么都搞不定,后检查log文件,发现访问8080端口时,确实访问到了wordpress目录,只是后来跳转到了discuz目录,所以确定是wordpress的默认端口80导致的跳转。

  • 修改wordpress的默认端口后,多端口访问多站点功能成功实现

相关文章

  • 多端口实现多站点的方法

    前言 之前已经在多网站搭建中用多域名的方式实现了多网站的搭建,这次简单记录下在没有域名时,使用多端口实现多站点搭建...

  • Apache 多端口多站点配置方法

    操作系统Red Hat,apache版本2.4.*首先修改httpd.conf配置文件。 把 改成 就是使用虚拟配...

  • MacOS中启动Apache多站点配置

    本文介绍的多站点配置方法是MacOS中默认的配置方法,其实还有其他方法来配置多站点,方法要更简单一些,只是不推荐而...

  • Apache多站点实现原理

    apache安装服务 很多人常常看到一台服务器上跑多个站点,不同的域名访问不同的站点,就会有个疑惑:访问的时候并没...

  • Mac Apache vhosts配置多端口无效

    虚拟主机配置 关于如何多个虚拟主机就不说了,网上很多介绍文章,例如:Mac下利用apache进行多站点配置 多端口...

  • 用WordPress多站点(Multisite)做SaaS平台的

    我们都知道wordpress可以开启多站点功能(Multisite),通过多站点功能可以实现集群建站和SaaS平台...

  • web自适应方案总结

    概要:网页自适应是什么?要解决什么问题?有什么方法论?其他站点的实现?我们站点现状?针对本站点提出建议? 网页自适...

  • Web站点安全监控

    Web站点安全监控认证旨在帮助学员了解一个典型的WEB站点的监控需求与目标,课程对比了采用传统方法实现站点监控的方...

  • Web站点安全监控

    Web站点安全监控认证旨在帮助学员了解一个典型的WEB站点的监控需求与目标,课程对比了采用传统方法实现站点监控的方...

  • CMS系统多站点设计研究与最终解决方案

    CMS系统多站点设计研究 多站点有隔离多站点 和 数据共享的多站点 1)数据共享的多站点,一般叫做站群 就是每个站...

网友评论

      本文标题:多端口实现多站点的方法

      本文链接:https://www.haomeiwen.com/subject/kafovttx.html