最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

wp config - What should index.php contain on Synology NAS to get external access to Wordpress to work?

programmeradmin0浏览0评论

Please note this is my first post here. Not sure if this question fits in the scope of this site. If not, I am happy for it to be closed.

I have a Synology NAS and I want to start a personal website using Wordpress. I have registered for a domain at noip and have installed Wordpress on my NAS (along with all the other required packages). noip is redirecting port 80 (which is blocked by my isp) to port 81 (which is not blocked). I have confirmed that the webserver is working by placing a 'index.html' file. When I navigate to the URL using my phone, I see the rendered version of 'index.html'. However, when I replace this with 'index.php', I get a 404 error from my PC, and "could not connect to server" from my phone.

The contents of index.php is:

<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );

I should also add that when I navigate to the internal ip address, I see the WordPress site.

So clearly noip is doing its job. So is my NAS/web server, else I wouldn't be able to see 'index.html' from my phone. Wordpress must be partly working and at least installed, else I wouldn't be able to see it from the LAN. This leads me to suspect that it is something about the WordPress configuration that is the problem, hence the question on this site.

EDIT:

I found the following in the wp.config.

$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80" and $_SERVER["SERVER_PORT"] != "443") {
    $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"];
} else {
    $pageURL .= $_SERVER["SERVER_NAME"];
}

Should I change the 80 to 81?

Please note this is my first post here. Not sure if this question fits in the scope of this site. If not, I am happy for it to be closed.

I have a Synology NAS and I want to start a personal website using Wordpress. I have registered for a domain at noip and have installed Wordpress on my NAS (along with all the other required packages). noip is redirecting port 80 (which is blocked by my isp) to port 81 (which is not blocked). I have confirmed that the webserver is working by placing a 'index.html' file. When I navigate to the URL using my phone, I see the rendered version of 'index.html'. However, when I replace this with 'index.php', I get a 404 error from my PC, and "could not connect to server" from my phone.

The contents of index.php is:

<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );

I should also add that when I navigate to the internal ip address, I see the WordPress site.

So clearly noip is doing its job. So is my NAS/web server, else I wouldn't be able to see 'index.html' from my phone. Wordpress must be partly working and at least installed, else I wouldn't be able to see it from the LAN. This leads me to suspect that it is something about the WordPress configuration that is the problem, hence the question on this site.

EDIT:

I found the following in the wp.config.

$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80" and $_SERVER["SERVER_PORT"] != "443") {
    $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"];
} else {
    $pageURL .= $_SERVER["SERVER_NAME"];
}

Should I change the 80 to 81?

Share Improve this question edited Jul 18, 2019 at 21:19 Castiblanco 2,1947 gold badges20 silver badges26 bronze badges asked Sep 13, 2018 at 15:35 Chechy LevasChechy Levas 1011 bronze badge 4
  • You shouldn't need to change any files. In the WordPress settings you need to set the URL to the URL you use to access it externally. – Jacob Peattie Commented Sep 13, 2018 at 15:47
  • That sort of half worked. In the setting Site Address (URL), I entered my domain name. Didn't work. Then I entered my domain name, followed by ':81', then it half worked. It loaded without the theme. Just text. Is this expected from an iPhone? – Chechy Levas Commented Sep 13, 2018 at 15:55
  • Also, that snippet from wp-config.php is not normal – Tom J Nowell Commented Sep 13, 2018 at 15:55
  • What does the snippet do? I don't speak php yet. – Chechy Levas Commented Sep 13, 2018 at 15:58
Add a comment  | 

1 Answer 1

Reset to default 1

please note: WP from Synology NAS uses MariaDB/MySQL to store & organize its content, thus you need to set up a user account(e.g. WP_User) in the database(by using e.g. phpMySQLAdmin) to give 'read' privilege from anywhere (.),

Secondly, please pay attention to MariaDB is using the port of 3307(not MySQL 3306) as default, if you are to align this with NAS firewall.

please check this for details: https://community.synology/enu/forum/17/post/55736?page=5&sort=oldest

发布评论

评论列表(0)

  1. 暂无评论