奇忠诚 发表于 2018-11-21 10:52:12

Apache配置通过多个端口访问多虚拟机

  首先在http.conf文件中增加监听端口
  Listen 8081
  Listen 8090
  配置apache访问的根目录
  ServerName 10.x.x.138:8090
  DocumentRoot "/act_data/apache2/htdocs"
  配置目录路径
  
  Options Indexes FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
  
  (可选) 可以将不同的访问路径别名
  
  Alias /index.php /act_data/apache2/htdocs/count
  ScriptAlias /cgi-bin/ "/act_data/apache2/cgi-bin/"
  
  允许访问php
  AddType application/x-httpd-php .php
  开启虚拟配置
  # Virtual hosts
  Include conf/extra/httpd-vhosts.conf
  在extra中的httpd-vhosts.conf对虚拟机访问路径进行配置
  NameVirtualHost 10.28.7.138
  
  ServerName localhost
  DocumentRoot "/act_data/apache2/htdocs/count/"
  
  Options Indexes FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
  
  
  
  ServerName localhost
  DocumentRoot "/act_data/apache2/htdocs/countskin/"
  
  Options Indexes FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
  
  
  检查虚拟主机配置是否正确
  apachectl -S#a synonym for -t -D DUMP_VHOSTS
  VirtualHost configuration:
  ...
  Syntax OK
  apachectl-t -D

页: [1]
查看完整版本: Apache配置通过多个端口访问多虚拟机