Wordpress站点在LAN上加载,但不是从WAN上加载,但父方向都加载了这两个

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

-------------------------已解决---------------------- ---

请参阅@fubar评论部分中的解决方案。

目标:使用Web Station Suite在我的Synology上建立的Wordpress网站。从no-ip使用免费的ddns使其可访问。

当前状态:可通过http://192.168.1.157:888/wordpress/在LAN中访问站点。但是无法从http://tnz.ddns.name:888/wordpress/的WAN访问。

但是,http://192.168.1.157:888/index.htmlhttp://tnz.ddns.name:888/index.html都将加载。

192.168.1.157:888是Web站点的父目录,它将在下图中加载'index.html':Web Station Directory

192.168.1.157:888/wordpress/显然是Wordpress网站的目录,该文件夹的结构如下所示:directory of the Wordpress site

以下是我发现的唯一相关的设置项目,似乎很相关。Wordpress Settings

摘要,除wordpress文件夹外,所有内容都会加载,我高度怀疑这是wordpress的设置问题。然而,我没有找到类似情况的人。

。htaccess文件内容:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>

# END WordPress

wp-config.php文件内容:

<?php
/**
 * The base configurations of the WordPress.
 *
 * This file has the following configurations: MySQL settings, Table Prefix,
 * Secret Keys, and ABSPATH. You can find more information by visiting
 * {@link https://codex.wordpress.org/Editing_wp-config.php Editing wp-config.php}
 * Codex page. You can get the MySQL settings from your web host.
 *
 * This file is used by the wp-config.php creation script during the
 * installation. You don't have to use the web site, you can just copy this file
 * to "wp-config.php" and fill in the values.
 *
 * @package WordPress
 */

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME','wordpressblog');

/** MySQL database username */
define('DB_USER','wordpress');

/** MySQL database password */
define('DB_PASSWORD','');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
/*keys are deleted here just to be safe on the web :P*/
define('AUTH_KEY',' '); 
define('SECURE_AUTH_KEY',' ');
define('LOGGED_IN_KEY',' ');
define('NONCE_KEY',' ');
define('AUTH_SALT',' ');
define('SECURE_AUTH_SALT',' ');
define('LOGGED_IN_SALT',' ');
define('NONCE_SALT',' ');

/**#@-*/

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each a unique
 * prefix. Only numbers, letters, and underscores please!
 */
$table_prefix  = 'wp_';

/**
 * WordPress Localized Language, defaults to English.
 *
 * Change this to localize WordPress. A corresponding MO file for the chosen
 * language must be installed to wp-content/language-selector/languages. For example, install
 * de_DE.mo to wp-content/language-selector/languages and set WPLANG to 'de_DE' to enable German
 * language support.
 */
define('WPLANG', 'en_En');
define('WP_LANG_DIR', '/volume1/web/wordpress/wp-content/plugins/language-selector/language-selector/languages');

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 */
define('WP_DEBUG', false);

/* That's all, stop editing! Happy blogging. */
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "888") {
    $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"];
} else {
    $pageURL .= $_SERVER["SERVER_NAME"];
}

$virtual_host_file = file_get_contents("/etc/httpd/sites-enabled-user/httpd-vhost.conf-user");
if (preg_match('/ServerName '.$_SERVER["SERVER_NAME"].'/', $virtual_host_file)) {
    define('WP_SITEURL', $pageURL);
} else {
        define('WP_SITEURL', $pageURL.'/wordpress');
}

if (!defined('SYNOWORDPRESS'))
    define('SYNOWORDPRESS', 'Synology Inc.');

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
require_once(ABSPATH . 'syno-misc.php');
php html wordpress .htaccess
1个回答
0
投票

我知道这已经有很长的历史了,但仅是在此处添加解决方案:

在wp-config.php中,注释掉:

if ($_SERVER["HOST"] != "") {
    define('WP_SITEURL', $pageURL);
} else {
    define('WP_SITEURL', $pageURL.'/wordpress');

这使两个地址均可在gui中进行编辑。

© www.soinside.com 2019 - 2024. All rights reserved.