1

Hello guys trying to configurate my webserver using nginx and php5-fpm.

When i try to restart/start/stop nginx it shows:

Restarting nginx: 
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
nginx.

Logs show the same thing.

My site configs:

server {

            listen   80;

            listen   [::]:80;

            root /home/marker/Projects/stereoshoots/www;

            server_name stereoshoots.local;







            location / {

                    autoindex  on;

    #                try_files $uri $uri/ @rewrite;

                    try_files $uri $uri/ /index.php;

            }

    #        location @rewrite {

    #                rewrite ^/(.*)$ /index.php?q=$1;

    #        }

            location ~* \.(jpg|jpeg|gif|css|png|js|ico|xml|txt)$ {

                access_log        off;

                expires           30d;

            }

            location = /favicon.ico {

                    return 204;

                    access_log     off;

                    log_not_found  off;

            }

            location ~ \.php$ {

                    fastcgi_pass unix:/var/run/php5-fpm.sock;

                    fastcgi_index index.php;

                    include fastcgi_params;

            }

            location ~ /\.ht {

                    deny all;

            }

    }

The list of commands i wrote in terminal, while was installing nginx+php5-fpm

1.sudo apt-get install nginx
2.sudo apt-get install php5-cli php5-common php5-mysql php5-suhosin php5-gd php5-fpm php5-cgi php5-fpm php-pear php5-mcrypt
3.sudo service nginx stop
4.sudo service php5-fpm stop
5.sudo gedit /etc/php5/fpm/php.ini
cgi.fix_pathinfo = 0;
6.sudo gedit /etc/php5/fpm/pool.d/www.conf
security.limit_extensions = .php .php3 .php4 .php5
listen = /var/run/php5-fpm.sock
  • Looks like port 80 is already in use. Apache perhaps? Skype? [This](http://stackoverflow.com/questions/6083109/cant-restart-nginx?rq=1) [and this](http://stackoverflow.com/questions/14972792/nginx-nginx-emerg-bind-to-80-failed-98-address-already-in-use?rq=1) [and this](http://stackoverflow.com/questions/15983050/restarting-nginx-nginxnginx-emerg-bind-to-0-0-0-080-failed-98-address-a?rq=1) looks related – AmazingDreams Aug 02 '13 at 09:15
  • No apache, there is skype thought. –  Aug 02 '13 at 17:59

2 Answers2

1

If you wanna support both ipv4 and ipv6(you should, since companies like Apple has already moved to ipv6-only network, 2016.8, as of now), you need to remove listen 80 and only keep the following in your nginx configs,

listen [::]:80

And probably also this,

listen [::]:443

And remember, you need to change all of listen 80, listen 443 in your configs to listen [::]:80, listen [::]:443. Don't forget the configs in /etc/nginx/sites-available/default

h--n
  • 5,903
  • 4
  • 31
  • 32
0

Skype uses port 80,443 by default, those are EXACTLY the http and https ports. Try shutting down skype and restarting nginx.

If you are using the 'desktop version' of Skype you can change this setting by the way of tools>options>advanced>connections > untick use port 80 and 443 as alternatives.

If you are using the win8 app, the only option seems to be shutting down skype completely or removing it completely.

Someone has to confirm the win8 app though, I use linux.

AmazingDreams
  • 3,136
  • 2
  • 22
  • 32