Ubuntu error with apache: (98)Address already in u

2019-01-30 15:48发布

I am getting this error when I try to start Apache in Ubuntu.

 (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
 no listening sockets available, shutting down
 Unable to open logs
 Action 'start' failed.

I have this in my ports.conf

NameVirtualHost *:80
Listen 80

This is my vhost file

<VirtualHost *:80>
          ServerAdmin example@example.com
          ServerName rails.server.com
          # ServerAlias
          DocumentRoot /var/www/sample_app/current/public
          ErrorLog /var/www/sample_app/error.log

          RailsEnv production
        <Directory "/var/www/sample_app/current/public">
          Options Indexes FollowSymLinks MultiViews
          Order allow,deny
          Allow from all
        </Directory>
</VirtualHost>

What am I missing?

14条回答
放我归山
2楼-- · 2019-01-30 16:33

In my case, I had removed the default ssl.conf file (renamed to ssl.conf.bak), and had my own ssl config file.

Then I did a yum update and it updated apache... Which also reintroduced the file ssl.conf, which means how I had 2 conf files with Listen 443.

Solution (generic - CentOS): go to /etc/httpd/conf.d, do a grep -r 'Listen' ., see if you have duplicate Listen XXX statements, remove them as required.

查看更多
姐就是有狂的资本
3楼-- · 2019-01-30 16:34

I had the same issue with a very different cause. I am running Apache 2.4.7 with PHP 5.5.6 on CentOS 6.5.

I messed up php.ini by having BOTH output_handler=ob_gzhandler AND zlib.output_compression=On (either one, not both, can be set).

So on restarting Apache, it binds to port 80 but nothing else happens. It looks like it is running but php's error locked it up somewhere.

The clue was to check "php -v" ... when I saw it not returning anything (it wrote the error to error_log), I fixed php.ini and Apache was happy again.

Maybe this helps someone...

查看更多
登录 后发表回答