Ubuntu 14.04:Apache 2.4.7虚拟主机无法正常工作/重定向

前端之家收集整理的这篇文章主要介绍了Ubuntu 14.04:Apache 2.4.7虚拟主机无法正常工作/重定向前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在我的Ubuntu 14.04机器上安装了Apache 2.4.7,我的一些虚拟主机不同意我的意见.我有5个虚拟主机,我正在尝试运行;其中3个工作,2个不工作.两个不起作用的.conf文件是:

002-tmpnet.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/tmpnet
    ServerName  tmpnet
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    <Directory /var/www/html/tmpnet/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        #Order allow,deny
        #allow from all
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

003-tmpcom.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/tmpcom
    ServerName  tmpcom
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    <Directory /var/www/html/tmpcom>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        #Order allow,deny
        #allow from all
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

这两个都回归了

500 Internal server errors

当试图访问他们.如果我通过localhost(即localhost / html / tmpnet)访问它们,它可以正常工作,而不是在尝试使用虚拟主机时.

我的主机文件是:

127.0.0.1   localhost
127.0.1.1   Eagle
127.0.1.1   tmpcom
127.0.1.1   tmpbiz
127.0.1.1   tmporg
127.0.1.1   tmpnet
127.0.1.1   thatsmybrick

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

我的apache2.conf是:

Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5

# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

HostnameLookups on
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride All
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

AccessFileName .htaccess

<FilesMatch "^\.ht">
    Require all denied
</FilesMatch>

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

IncludeOptional conf-enabled/*.conf

IncludeOptional sites-enabled/*.conf

我已经被困在这一段很长一段时间了,我真的很感激一些帮助.任何指向正确方向的都会令人惊叹.

谢谢

这可能有点晚了,不确定你是否找到了解决方案,但这就是我所做的.在花了很多时间修改我的配置文件并调整我的vhost之后,我决定使用a2dissite 000 …默认站点并重新加载apache.一旦我这样做,重定向就像epxected一样工作.当你在服务器上有多个站点时,我不知道这将如何展开,如果它将默认为第一个加载的vhost或…我总是认为apache必须有一个默认主机,我可以那是错的.
原文链接:https://www.f2er.com/ubuntu/347339.html

猜你在找的Ubuntu相关文章