vincen 发表于 2017-12-25 11:21:34

centos7 Apache 2.4.6 多域名多网站配置

Apache 2.4.6 多域名多网站配置
  在/etc/httpd/conf 下 编辑
  vim httpd.conf
  添加:ServerName 外网IP
  并注释
  #DocumentRoot "/var/www/html/"
  在 /etc/httpd/conf.d下 编辑文件
  vim httpd-vhosts.conf
  内容如下:
  NameVirtualHost *:80
  <VirtualHost *:80>
  ServerName www.yanwen.mobi
  DocumentRoot "/var/www/html/ywapp"
  <Directory "/var/www/html/ywapp">
  Require all granted
  Options Indexes FollowSymLinks MultiViews
  AllowOverride All
  Order allow,deny
  allow from all
  </Directory>
  </VirtualHost>
  <VirtualHost *:80>
  ServerName doctor.yanwen.mobi
  DocumentRoot "/var/www/html/test"
  #Alias /course "/var/www/html/test" 取别名
  <Directory "/var/www/html/test">
  Require all granted
  Options Indexes FollowSymLinks MultiViews
  AllowOverride All
  Order allow,deny
  allow from all
  #Options +Includes -Indexes
  #Options FollowSymLinks
  </Directory>
  </VirtualHost>
  重启程序
  systemctlrestart httpd
  查看状态
  systemctl status -lhttpd
  参考:
  http://www.linuxsir.org/linuxfxbsuse/8435.html
  http://blog.csdn.net/zhanglei5415/article/details/6821066
  前提是 二级域名已经在购买商管理处解析过,可以在/etc/hosts下添加 配置下
在apache中设置访问目录后进入的默认页面为index.php
找到apache的配置文件httpd.conf后找到  <IfModule dir_module>
  DirectoryIndex index.html index.php
  </IfModule>
  在其中添加index.php,
参考:http://www.cnblogs.com/w-y-f/p/3489518.htmlhttp://blog.csdn.net/cjsyr_cjsyr/article/details/51516009http://www.iyunv.net/article/98269.htm
页: [1]
查看完整版本: centos7 Apache 2.4.6 多域名多网站配置