使用 Nginx 和 apache 修复 Mediawiki 的 80 个 url

Fixing :80 urls for Mediawiki with Nginx and apache

我正在尝试使用 Mediawiki,但没有让 url 变成这样。

https://roblox-network.com:80/tra/Special:RequestAccount

如果我只是删除 :80 它会正常工作。

配置文件如下。

它应该是全新安装,具有受限帐户。 但遗憾的是,当我更新每一页时,我多次收到 :80 url 。 所以我必须删除 :80 来更新页面。

<?php

error_reporting( E_ALL );
ini_set( 'display_errors', 1 );

# This file was automatically generated by the MediaWiki 1.17.0
# installer. If you make manual changes, please keep track in case you
# need to recreate them later.
#
# See includes/DefaultSettings.php for all configurable settings
# and their default values, but don't forget to make changes in _this_
# file, not there.
#
# Further documentation for configuration settings may be found at:
# http://www.mediawiki.org/wiki/Manual:Configuration_settings

# Protect against web entry
if ( !defined( 'MEDIAWIKI' ) ) {
    exit;
}

## Uncomment this to disable output compression
# $wgDisableOutputCompression = true;

$wgSitename      = 'TRA Wiki';
$wgMetaNamespace = "My_wiki";
$wgRightsPage = "YourWiki:Copyright"; 
$wgRightsText = "copyright Roblox Network";

## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath       = '/tra';
$wgRunJobsAsync = false;
$wgArticlePath = $wgScriptPath.'/';
$wgScriptExtension  = ".php";

## The relative URL path to the skins directory
$wgStylePath        = "$wgScriptPath/skins";

## The relative URL path to the logo.  Make sure you change this from the default,
## or else you'll overwrite your logo when you upgrade!
#$wgLogo             = "$wgStylePath/common/images/wiki.png";
$wgLogo             = "$wgStylePath/common/images/wiki.png";

## UPO means: this is also a user preference option

$wgEnableEmail      = true;
$wgEnableUserEmail  = true; # UPO

$wgEmergencyContact = 'info@roblox-network.com';
$wgPasswordSender   = 'no-reply@roblox-network.com';

$wgEnotifUserTalk      = false; # UPO
$wgEnotifWatchlist     = false; # UPO
$wgEmailAuthentication = true;

## Database settings
$wgDBtype           = "mysql";
$wgDBserver         = 'mysql';
$wgDBname           = 'REMOVED';
$wgDBuser           = 'REMOVED';
$wgDBpassword       = 'REMOVED';

# MySQL specific settings
$wgDBprefix         = 'REMOVED';

# MySQL table options to use during installation or update
$wgDBTableOptions   = "ENGINE=InnoDB, DEFAULT CHARSET=binary";

# Experimental charset support for MySQL 4.1/5.0.
$wgDBmysql5 = false;

## Shared memory settings
$wgMainCacheType    = CACHE_NONE;
$wgMemCachedServers = array();

## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads  = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";

# InstantCommons allows wiki to use images from http://commons.wikimedia.org
$wgUseInstantCommons  = false;

## If you use ImageMagick (or any other shell command) on a
## Linux server, this will need to be set to the name of an
## available UTF-8 locale
$wgShellLocale = "en_US.utf8";

## If you want to use image uploads under safe mode,
## create the directories images/archive, images/thumb and
## images/temp, and make them all writable. Then uncomment
## this, if it's not already uncommented:
#$wgHashedUploadDirectory = false;

## If you have the appropriate support software installed
## you can enable inline LaTeX equations:
$wgUseTeX           = false;

## Set $wgCacheDirectory to a writable directory on the web server
## to make your wiki go slightly faster. The directory should not
## be publically accessible from the web.
#$wgCacheDirectory = "$IP/cache";

# Site language code, should be one of ./languages/Language(.*).php
$wgLanguageCode = 'en';

$wgSecretKey = "REMOVED";

# Site upgrade key. Must be set to a string (default provided) to turn on the
# web installer while LocalSettings.php is in place
$wgUpgradeKey = "REMOVED";

## Default skin: you can change the default skin. Use the internal symbolic
## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook', 'vector':
$wgDefaultSkin = "vector";

## For attaching licensing metadata to pages, and displaying an
## appropriate copyright notice / icon. GNU Free Documentation
## License and Creative Commons licenses are supported so far.
#$wgEnableCreativeCommonsRdf = true;
$wgRightsPage = "Roblox Network"; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl  = "https://roblox-network.com/terms/";
$wgRightsText = "";
$wgRightsIcon = "";
# $wgRightsCode = ""; # Not yet used

# Path to the GNU diff3 utility. Used for conflict resolution.
$wgDiff3 = "/usr/bin/diff3";



# Query string length limit for ResourceLoader. You should only set this if
# your web server has a query string length limit (then set it to that limit),
# or if you have suhosin.get.max_value_length set in php.ini (then set it to
# that value)
$wgResourceLoaderMaxQueryLength = -1;


# End of automatically generated settings.
# Add more configuration options below.
require_once "$IP/skins/Vector/Vector.php";

# ------------------ Below is the custom settings. ----------------------------

require_once "$IP/extensions/ConfirmAccount/ConfirmAccount.php";
require_once "$IP/extensions/SecurePoll/SecurePoll.php";

$wgShowSQLErrors = true;
$wgDebugDumpSql = true;
$wgShowDBErrorBacktrace = true;


$wgConfirmAccountContact = 'tra@roblox-network.com';

# ------------------ Below is the custom permissions. ----------------------------

$wgGroupPermissions['sysop']['securepoll-create-poll'] = true;

# ------------------ Below is loginform permissions. ----------------------------

$wgAccountRequestMinWords = 10;
$wgConfirmAccountRequestFormItems['Biography']['enabled'] = false;


 $wgMakeUserPageFromBio = false;
 $wgAutoWelcomeNewUsers = false;
 $wgConfirmAccountRequestFormItems = array(
    'UserName'        => array( 'enabled' => true ),
    'RealName'        => array( 'enabled' => false ),
    'Biography'       => array( 'enabled' => false, 'minWords' => 50 ),
    'AreasOfInterest' => array( 'enabled' => false ),
    'CV'              => array( 'enabled' => false ),
    'Notes'           => array( 'enabled' => true ),
    'Links'           => array( 'enabled' => false ),
    'TermsOfService'  => array( 'enabled' => true ),
 );

# ------------------ Below is loginform restricted. ----------------------------


function efLoginFormMessage( &$template ) {
    $template->set( 'header', "(For an account to edit articles with, contact Mr.Master3395, info@roblox-network.com )");
    return true;
}
$wgHooks['UserLoginForm'][]='efLoginFormMessage';

# End of automatically generated settings.
# Add more configuration options below.
require_once "$IP/skins/Vector/Vector.php";

# Disable reading by anonymous users
$wgGroupPermissions['*']['read'] = true;

# But allow them to access the login page or else there will be no way to log in!
# (You also might want to add access to "Main Page", "Help:Contents", etc.)
$wgWhitelistRead = array ("Special:Userlogin");

# Disable anonymous editing
$wgGroupPermissions['*']['edit'] = false;

# Prevent new user registrations except by sysops
$wgGroupPermissions['*']['createaccount'] = false;

# ------------------ Below is Group Permissions. ----------------------------


$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['user']['edit'] = false;
$wgGroupPermissions['sysop']['edit'] = true;



# ------------------ Below is Uploads. ----------------------------


$wgUploadPath       = "$wgScriptPath/uploads";      ## Wiki 1.5 defaults to /images, but allows more than just images
$wgUploadDirectory  = "$IP/uploads";                ## Wiki 1.5 defaults to /images, but allows more than just images

## To enable image uploads, make sure the above '$wgUploadPath' directory is writable by Apache User or group.
## ''(i.e.  chmod og+w uploads images)''  then the following should be true:
$wgEnableUploads       = true;

$wgUseImageMagick      = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";

## If you want to use image uploads under safe mode, create the directories images/archive, images/thumb and
## images/temp, and make them all writable. Then uncomment this, if it's not already uncommented:
$wgHashedUploadDirectory = false;

# ------------------ Below is Uploads. ----------------------------


// Add just one filetype to the default array
$wgFileExtensions[] = 'pdf';

// Add several file types to the default array
$wgFileExtensions = array_merge(
    $wgFileExtensions, array(
        'pdf', 'ppt', 'jp2', 'webp', 'doc','docx', 'xls', 'xlsx'
        )
    );

// Override the default with a bundle of filetypes:
$wgFileExtensions = array(
    'png', 'gif', 'jpg', 'jpeg', 'jp2', 'webp', 'ppt', 'pdf', 'psd',
    'mp3', 'xls', 'xlsx', 'swf', 'doc','docx', 'odt', 'odc', 'odp',
    'odg', 'mpp'
    );

$wgMimeDetectorCommand = "file -bi";


# ------------------ Below is Google Analytics. ----------------------------

require_once "$IP/extensions/googleAnalytics/googleAnalytics.php";
// Replace xxxxxxx-x with YOUR GoogleAnalytics UA number
$wgGoogleAnalyticsAccount = 'UA-37062089-17'; 
// Add HTML code for any additional web analytics (can be used alone or with $wgGoogleAnalyticsAccount)
$wgGoogleAnalyticsOtherCode = '<script type="text/javascript" src="https://analytics.example.com/tracking.js"></script>';

// Optional configuration (for defaults see googleAnalytics.php)
// Store full IP address in Google Universal Analytics (see https://support.google.com/analytics/answer/2763052?hl=en for details)
$wgGoogleAnalyticsAnonymizeIP = false; 
// Array with NUMERIC namespace IDs where web analytics code should NOT be included.
$wgGoogleAnalyticsIgnoreNsIDs = array(500);
// Array with page names (see magic word Extension:Google Analytics Integration) where web analytics code should NOT be included.
$wgGoogleAnalyticsIgnorePages = array('ArticleX', 'Foo:Bar');
// Array with special pages where web analytics code should NOT be included.
$wgGoogleAnalyticsIgnoreSpecials = array( 'Userlogin', 'Userlogout', 'Preferences', 'ChangePassword', 'OATH');
// Use 'noanalytics' permission to exclude specific user groups from web analytics, e.g.
$wgGroupPermissions['sysop']['noanalytics'] = true;
$wgGroupPermissions['bot']['noanalytics'] = true;
// To exclude all logged in users give 'noanalytics' permission to 'user' group, i.e.
$wgGroupPermissions['user']['noanalytics'] = true;

# ------------------ Below is Logo. ----------------------------

 $wgLogoHD = array(
    "1.5x" => "images/main/wiki.png",
#   "2x" => "images/main/wiki.png"
 );

# The URL path of the shortcut icon.
# @since 1.6
#/
#$wgFavicon = 'images/main/favicon.ico';

# The URL path of the icon for iPhone and iPod Touch web app bookmarks.
# Defaults to no icon.
# @since 1.12
#/
$wgAppleTouchIcon = false;

# ------------------ Below is Login Link. ----------------------------

$wgHooks['PersonalUrls'][] = 'onPersonalUrls';

function onPersonalUrls( array &$personal_urls, Title $title, SkinTemplate $skin  ) {
    // Add a link to Special:RequestAccount if a link exists for login
    if ( isset( $personal_urls['login'] ) || isset( $personal_urls['anonlogin'] ) ) {
            $personal_urls['createaccount'] = array(
                'text' => wfMessage( 'requestaccount' )->text(),
                'href' => SpecialPage::getTitleFor( 'RequestAccount' )->getFullURL()
            );
    }
    return true;
}

https 是默认端口 443,端口 80 为 http 保留。

问题表明端口 80 未处理 SSL。

您的问题似乎只与 Confirm Account 扩展有关,因为所有其他链接似乎都没有问题。我注意到您的配置中缺少 $wgServer,因此尝试在 LocalSettings.php 中指定 $wgServer 变量,如下所示:

$wgServer = "https://roblox-network.com";