Tôi có Apache 2.4.7 được cài đặt trên máy tính Ubuntu 14.04 của mình và một số máy chủ ảo của tôi không đồng ý với tôi. Tôi có 5 máy chủ ảo mà tôi đang cố chạy; 3 người trong số họ làm việc, 2 thì không. Các file conf cho hai mà không làm việc là:Ubuntu 14.04: Apache 2.4.7 virtualhost không hoạt động/chuyển hướng
002-tmpnet.conf
<VirtualHost *:80>
ServerAdmin [email protected]
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 [email protected]
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>
Cả hai trở
500 Internal server errors
whe n cố gắng đến thăm họ. Nếu tôi truy cập chúng thông qua localhost (ví dụ: localhost/html/tmpnet), nó hoạt động hoàn toàn tốt, không phải khi cố gắng sử dụng máy chủ ảo.
host của tôi nộp là:
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
và tôi apache2.conf là:
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
Tôi đã bị mắc kẹt trên này một thời gian dài trong khi bây giờ, và tôi sẽ thực sự đánh giá cao một số trợ giúp. Bất kỳ chỉ hướng nào đúng hướng sẽ thật tuyệt vời.
Cảm ơn bạn
Cảm ơn bạn !!! Tôi chạy 'a2dissite 000-default.conf' và thêm' .conf' vào các tệp hiện có của tôi và nó đã hoạt động! – Skovy