我已经运行了Mediawiki很多年了。我的服务器运行两个端口:活动站点的端口80
和测试站点的端口81
,在“上线”之前升级MW软件时使用。直到最近我才对这个设置有任何问题。两个端口都运行良好,包括在端口81上对MW 1.27 Alpha进行早期测试。现在我正在尝试安装MW 1.27.0(稳定),我遇到了问题。
出于某种原因,我只能在一个端口上获得http。如果我重新启动Apache,任何端口都将提供内容,但只有该端口,它始终是我访问的第一个端口。另一个将给出一些PHP错误。例如:重新启动Apache并转到端口81上的站点。工作正常,但端口80
站点出现PHP错误。什么都不做,但重新启动Apache并转到80端口站点;工作正常,但端口81站点现在给出PHP错误。这两个站点都给出了不同的PHP错误,但总是出现相同的错误。
这显然与我的Apache设置有关,但我不知道是什么。它在过去是有效的,并没有改变。 OS或Apache应用程序文件没有更改/更新。端口在apache2/ports.conf
中定义,两个站点都在单独的VirtualHosts
配置文件中定义。
两个站点都已启用,并且Apache(/usr/sbin/apache2 -S
)已读取配置文件。
netstat -lep --tcp
显示端口80
和81
正在被主动收听,但这两个事实都有点无关紧要,因为我已经证明两个端口都可以服务,而不是同一时间。我已经检查了apache错误日志文件,但是那里只记录了PHP错误。
我应该补充一点,服务器有另一个端口运行的第三个站点(8083),它运行正常。所有三种配置都具有可比性,仅在任何指定路径(例如DocumentRoot
)和端口号上有所不同。
有人有任何建议吗?
代码:
ports.conf:
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf
Listen 0.0.0.0:80
Listen 0.0.0.0:81
Listen 0.0.0.0:8083
Listen 0.0.0.0:8080
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
wiki.conf: 注意:出于业务/安全原因,ServerAdmin变量已被更改。
#Variable to store the top level server name
Define TL_ServerName lgsim
<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.example.com
ServerAdmin abc@myDomain.com
DocumentRoot /var/www/wiki
ServerName ${TL_ServerName}
# ServerName 44.80.10.2
ServerAlias ${TL_ServerName}
DirectoryIndex index.php lgsim_redirect.html
Alias /w /var/www/wiki
Alias /wiki /var/www/wiki/index.php
Alias /error_html/ /var/www/html/error_html/
Alias /addSearch/ /var/www/html/addSearch/
<Directory "/var/www/wiki">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
# For security, deny access to the MW config directory.
# Comment this out if you're running an upgrade.
<Directory "/var/www/wiki/mw-config">
Order allow,deny
Deny from all
</Directory>
<Directory "/var/www/wiki/images">
Options -Indexes
</Directory>
ErrorDocument 404 /error_html/custom404.html
#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>
# Template for the virtual host alias currently in use
<Macro VHost $name $redirectURL>
<VirtualHost *:80>
DocumentRoot "/var/www/wiki"
ServerName $name
Redirect permanent / $redirectURL
</VirtualHost>
</Macro>
#
#Landing Gear Virtual Hosts
#
Use VHost LG http://${TL_ServerName}/wiki/LG:Main_Page
Use VHost LGSIM http://${TL_ServerName}/wiki/LGSIM:Main_Page
Use VHost LGMS http://${TL_ServerName}/wiki/LGMS:Main_Page
UndefMacro VHost
newWiki.conf:
#Variable to store the top level server name
Define TL_ServerName lgsim
<VirtualHost *:81>
ServerAdmin abc@myDomain.com
DocumentRoot /var/www/wiki_test
# ServerName 44.80.10.2
ServerName ${TL_ServerName}
ServerAlias ${TL_ServerName}
DirectoryIndex index.php # lgsim_redirect.html
Alias /w /var/www/wiki_test
Alias /wiki /var/www/wiki_test/index.php
Alias /error_html/ /var/www/html/error_html/
Alias /addSearch/ /var/www/html/addSearch/
<Directory "/var/www/wiki_test">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
# For security, deny access to the MW config directory.
# Comment this out if you're running an upgrade.
# <Directory "/var/www/wiki_test/mw-config">
# Order allow,deny
# Deny from all
# </Directory>
<Directory "/var/www/wiki_test/images">
Options -Indexes
</Directory>
ErrorDocument 404 /error_html/custom404.html
ErrorLog ${APACHE_LOG_DIR}/wiki_test_error.log
CustomLog ${APACHE_LOG_DIR}/wiki_test_access.log combined
</VirtualHost>