thewoosterisroot
Posts: 2
Joined: Sat Jul 11, 2015 7:53 pm

Raspberry Pi 2: Nginx will not bind [SOLVED]

Sat Jul 11, 2015 8:01 pm

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!
Last edited by thewoosterisroot on Sun Jul 12, 2015 12:24 pm, edited 1 time in total.

myoung008
Posts: 55
Joined: Mon Mar 18, 2013 9:56 pm

Re: Raspberry Pi 2: Nginx will not bind

Sun Jul 12, 2015 6:49 am

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.

thewoosterisroot
Posts: 2
Joined: Sat Jul 11, 2015 7:53 pm

Re: Raspberry Pi 2: Nginx will not bind

Sun Jul 12, 2015 12:23 pm

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!

Return to “Beginners”