Answer the question
In order to leave comments, you need to log in
How to set up access to Nexcloud via the Internet?
Hello!
There is a company with a website www.example.com which is hosted on the servers of a hosting provider. Inside the company's network there is a server on which 1c bases are spinning. The Internet provider has installed Zyxell Kinetik Lite and provides access to the global network with a static IP address. The router is configured to forward port 80 to a server with 1s databases. Now the user types in the browser 123.123.123.123/baza1c1 or 123.123.123.123/baza1c2 and enters the desired database. Everything works on http. I wanted beauty and a subdomain 1c.example.com was added to the hosting panel of the company's website, which was assigned an A record with the IP address of the company's router. Now the user types 1c.example.com/baza1c1 or 1c.example.com/baza1c2 and gets into the desired database.
There was a need to replace dropbox with a local solution, for which, according to numerous manuals, Nextcloud was installed for tests on a simple computer within the company's network. Inside the local network everything works great. And then I can’t connect to my nextcloud server via the Internet. Another subdomain cloud.example.com was registered in the hosting panel. The hoster was asked how to set up a redirect from cloud.example.com to our router with a static address 123.123.123.123:43334. I don't know what exactly the hoster did, but the redirect works. On the router itself, port forwarding 43334 was configured to the internal ip address of the nextcloud server on port 80. Now, when I contact cloud.example.com, I get to the welcome page of my web server running nextcloud,
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Georg Ehrke <oc.list@georgehrke.com>
* @author Joas Schilling <coding@schilljs.com>
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
* @author Lukas Reschke <lukas@statuscode.ch>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Robin Appelman <robin@icewind.nl>
* @author Sergio Bertolín <sbertolin@solidgear.es>
* @author Thomas Müller <thomas.mueller@tmit.eu>
* @author Vincent Petry <pvince81@owncloud.com>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
require_once __DIR__ . '/lib/versioncheck.php';
try {
require_once __DIR__ . '/lib/base.php';
OC::handleRequest();
} catch(\OC\ServiceUnavailableException $ex) {
\OC::$server->getLogger()->logException($ex, array('app' => 'index'));
//show the user a detailed error page
OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
OC_Template::printExceptionErrorPage($ex);
} catch (\OC\HintException $ex) {
OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
try {
OC_Template::printErrorPage($ex->getMessage(), $ex->getHint());
} catch (Exception $ex2) {
\OC::$server->getLogger()->logException($ex, array('app' => 'index'));
\OC::$server->getLogger()->logException($ex2, array('app' => 'index'));
//show the user a detailed error page
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
OC_Template::printExceptionErrorPage($ex);
}
} catch (\OC\User\LoginException $ex) {
OC_Response::setStatus(OC_Response::STATUS_FORBIDDEN);
OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage());
} catch (Exception $ex) {
\OC::$server->getLogger()->logException($ex, array('app' => 'index'));
//show the user a detailed error page
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
OC_Template::printExceptionErrorPage($ex);
} catch (Error $ex) {
try {
\OC::$server->getLogger()->logException($ex, array('app' => 'index'));
} catch (Error $e) {
$claimedProtocol = strtoupper($_SERVER['SERVER_PROTOCOL']);
$validProtocols = [
'HTTP/1.0',
'HTTP/1.1',
'HTTP/2',
];
$protocol = 'HTTP/1.1';
if(in_array($claimedProtocol, $validProtocols, true)) {
$protocol = $claimedProtocol;
}
header($protocol . ' 500 Internal Server Error');
header('Content-Type: text/plain; charset=utf-8');
print("Internal Server Error\n\n");
print("The server encountered an internal error and was unable to complete your request.\n");
print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n");
print("More details can be found in the webserver log.\n");
throw $e;
}
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
OC_Template::printExceptionErrorPage($ex);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question