Apache2.4.6无需配置NameVirtualHost

在CentOS7上搭建最新的LAMP环境,和往常一样用最新的yum源安装了最新版本的Apache、PHP及MySQL。

安装LAMP环境

# yum install httpd 
# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm 
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm 
# yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-pecl-apcu php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-pdo php-pear php-fpm php-cli php-xml php-bcmath php-process php-gd php-common 
# rpm -ivh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm 
# yum install mysql-server 
# systemctl list-unit-files --no-pager | egrep 'httpd|mysqld|php-fpm' 
# systemctl enable httpd 
# systemctl enable mysqld 
# systemctl enable php-fpm

※yum源的URL是会被更新的,需要确认最新的yum源。

配置Apache的vhost

安装完LAMP环境后,在Apache的vhosts.conf文件里追加了站点。

NameVirtualHost *:80

    ServerName www.zabbix.cc
    DocumentRoot /var/www/www.zabbix.cc
    DirectoryIndex index.html index.php
    
        Options +Includes -Indexes
        AllowOverride All
        Order Deny,Allow
        Allow from All
   

用httpd命令测试一下。

# httpd -t
ZABBIX.CC: NameVirtualHost has no effect and will be removed in the next release /etc/httpd/conf.d/vhosts.conf:1
Syntax OK

虽然显示文法正确,但是提示NameVirtualHost已经无效并且在下一个版本不在支持NameVitualHost。

根据提示删除NameVirtualHost *:80以后,再次测试结果OK。

# httpd -t
Syntax OK

你可能感兴趣的:(Linux)