尽管严格遵循在线指导,但虚拟主机仍无法正常工作

Virtual hosts not working despite following online guidance meticulously

可能没有什么比对这个问题的质疑更让人嗤之以鼻了,但我真的很茫然:

我有2个IP地址,第一个77.68.123.127是指向默认的VirtualHost,000-default == www.oneasl.com,第二个77.68.122.124,到 davical == cal.oneasl.com。附加了 2 个 conf 文件,然后是 'root@asl1:/etc/php/7.2/apache2# apache2ctl -S'

的输出

php 在 77.68.123.127/davical

工作

77.68.123.127 在浏览器中将我带到 apache2 欢迎页面 77.68.123.127/davical 带我到主登录 77.68.123.127:8080 带我到 tomcat8

到目前为止一切顺利

然而 77.68.122.124 应该 == 77.68.123.127/davical == cal.oneasl.com,但它没有加载任何东西...?

如果我忽略了一些明显的事情,非常感谢和抱歉。也很抱歉无故使用代码标记,但我不能 post 没有它!

000-default.conf;

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.

ServerName www.oneasl.com
ServerAdmin webmaster@oneasl.com
DocumentRoot /var/www/html

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

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

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

<VirtualHost 77.68.122.124:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless. 
# However, you must set it for any further virtual host explicitly.

ServerName cal.oneasl.com 
ServerAdmin admin@oneasl.com  
DocumentRoot /usr/share/davical/htdocs                      
</VirtualHost>                                                            

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

davical.conf:

# DAViCal Calendar Server

Alias /davical /usr/share/davical/htdocs
<Directory /usr/share/davical/htdocs>
DirectoryIndex index.php 
AllowOverride None
# for Apache from 2.4 use
Require all granted
# for Apache before 2.4 use 
#Order allow,deny
#Allow from all

# These are usually not necessary (set correctly by default)
#AcceptPathInfo On
#php_value include_path /usr/share/php/awl/inc
#php_value magic_quotes_gpc 0
#php_value register_globals 0
#php_value error_reporting "E_ALL & ~E_NOTICE"
#php_value default_charset "utf-8"

# Some people want this. YMMV.
#php_admin_value open_basedir
/usr/share/awl/inc/:/usr/share/davical/:/etc/davical/
</Directory>

<IfModule mod_rewrite.c>
RewriteEngine On

# PT is important if you are using an alias, it implies L
# Redirect /.well-known URLs
RewriteRule ^/\.well-known/(.*)$ /davical/caldav.php/.well-known/ [NC,PT]
# Optionally: redirect /principals/users/ as well
RewriteRule ^/principals/users/(.*)$ /davical/caldav.php/ [NC,PT]
RewriteRule ^/principals/resources/(.*)$ /davical/caldav.php/ [NC,PT]
RewriteRule ^/calendars/__uids__/(.*)$ /davical/caldav.php/ [NC,PT]
RewriteRule ^/addressbooks/__uids__/(.*)$ /davical/caldav.php/ [NC,PT]

# Optionally: Put DAViCal in the root
# NOTE: this will break other applications that rely on mod_rewrite!
#
# Not if it's the root URL.  You might want to comment this out if you
# want to use an explicit /index.php for getting to the admin pages.
#RewriteCond %{REQUEST_URI} !^/$
#RewriteCond %{REQUEST_URI} !^/davical/$
#
# Not if it explicitly specifies a .php program, html page, stylesheet or image
#RewriteCond %{REQUEST_URI} !\.(php|html|css|js|png|gif|jpg|ico)
#
# Everything else gets rewritten to /caldav.php/...
#RewriteRule ^(.*)$ /davical/caldav.php  [NC,L]
</IfModule>

'root@asl1:/etc/php/7.2/apache2# apache2ctl -S'的输出:

VirtualHost configuration:
77.68.122.124:80       cal.oneasl.com (/etc/apache2/sites-enabled/000-default.conf:32)
*:80                   www.oneasl.com (/etc/apache2/sites-enabled/000-default.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

似乎服务器上的辅助 IP 配置不正确。 同时能够在主服务器 ip www.oneasl.com

上远程登录
telnet oneasl.com 80
Trying 77.68.123.127...
Connected to oneasl.com.
Escape character is '^]'.
^]
telnet>

无法在辅助服务器 ip 上远程登录 cal.oneasl.com

 telnet cal.oneasl.com  80
 Trying 77.68.122.124...