严格按照网上的指导进行操作,但虚拟主机却无法正常工作。

问题描述 投票:0回答:1

可能在这个问题上,没有什么比问题更容易引起人们的唾弃,但我真的很茫然。

我有两个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 带我到Davical登录77.68.123.127:8080 带我去Tomcat8

迄今为止一切顺利

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

非常感谢,如果我忽略了一些明显的东西,很抱歉。也很抱歉无偿地使用了代码标记,但我不能不发帖!

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 [email protected]
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 [email protected]  
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/$1 [NC,PT]
# Optionally: redirect /principals/users/ as well
RewriteRule ^/principals/users/(.*)$ /davical/caldav.php/$1 [NC,PT]
RewriteRule ^/principals/resources/(.*)$ /davical/caldav.php/$1 [NC,PT]
RewriteRule ^/calendars/__uids__/(.*)$ /davical/caldav.php/$1 [NC,PT]
RewriteRule ^/addressbooks/__uids__/(.*)$ /davical/caldav.php/$1 [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$1  [NC,L]
</IfModule>

OUTPUT OF '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
linux apache2 virtualhost
1个回答
1
投票

似乎secondary ip没有在服务器上正确配置。同时能够在主服务器上telnet ip www.oneasl.com。

telnet oneasl.com 80
Trying 77.68.123.127...
Connected to oneasl.com.
Escape character is '^]'.
^]
telnet>

无法在辅助服务器上telnet ip cal.oneasl.com。

 telnet cal.oneasl.com  80
 Trying 77.68.122.124...
© www.soinside.com 2019 - 2024. All rights reserved.