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

时间:2020-06-10 18:07:25

标签: linux apache2 virtualhost

在这个问题上,可能没有什么比这问题引起更多的蔑视,但我真的很茫然:

我有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带我去了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 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/$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>

'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

1 个答案:

答案 0 :(得分:1)

似乎在服务器上未正确配置辅助IP。 能够在主服务器ip www.oneasl.com上telnet

React.createElement

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

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