Page 1 of 1

Raspberry Pi 2: Nginx will not bind [SOLVED]

Posted: Sat Jul 11, 2015 8:01 pm
by thewoosterisroot
Hi everyone! This is my first time setting up a raspberry pi (I am new to raspbian, but not linux). I just setup my raspberry pi with raspbian and got all of the basic configs in places. I am doing this all over ssh.

I am trying to install owncloud and am following these guides:
http://www.techjawab.com/2014/08/how-to ... ry-pi.html

http://www.element14.com/community/comm ... wn-dropbox

http://unixetc.co.uk/2015/02/21/simple- ... erry-pi-2/

I have gotten almost everything running; owncloud is installed, etc . . .

However, when I go to configure owncloud via the web interface I get this:
<?php
/**
* @author Frank Karlitschek <frank@owncloud.org>
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
* @author Lukas Reschke <lukas@owncloud.com>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Robin Appelman <icewind@owncloud.com>
* @author Thomas Müller <thomas.mueller@tmit.eu>
* @author Vincent Petry <pvince81@owncloud.com>
*
* @copyright Copyright (c) 2015, ownCloud, Inc.
* @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/>
*
*/

// Show warning if a PHP version below 5.4.0 is used, this has to happen here
// because base.php will already use 5.4 syntax.
if (version_compare(PHP_VERSION, '5.4.0') === -1) {
echo 'This version of ownCloud requires at least PHP 5.4.0<br/>';
echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.';
return;
}

try {

require_once 'lib/base.php';

OC::handleRequest();

} catch(\OC\ServiceUnavailableException $ex) {
\OCP\Util::logException('index', $ex);

//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);
OC_Template::printErrorPage($ex->getMessage(), $ex->getHint());
} catch (Exception $ex) {
\OCP\Util::logException('index', $ex);

//show the user a detailed error page
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
OC_Template::printExceptionErrorPage($ex);
}
So I double-checked all of my configs. Everything seemed correct until I tried to restart Nginx. I get the following message:

Code: Select all

 sudo /etc/init.d/nginx restart
Restarting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] still could not bind()
nginx.
I don't think anything else should be running on those ports atm. I re-generated the certs, and went over everything. Pointers?

Thanks all!

Re: Raspberry Pi 2: Nginx will not bind

Posted: Sun Jul 12, 2015 6:49 am
by myoung008
See what process is using the ports:

Code: Select all

sudo netstat -lpn
I've seen 'restart' not work on nginx in the past, try 'stop' and 'start' instead.

Re: Raspberry Pi 2: Nginx will not bind

Posted: Sun Jul 12, 2015 12:23 pm
by thewoosterisroot
Thanks! I actually figured this out (up far too late working on other things, must have been groggy!). Apache was running on that port, removed apache and everything is good!