M
M
MrBe2014-10-02 23:35:51
Apache HTTP Server
MrBe, 2014-10-02 23:35:51

What mistake did you make in the Apache2 settings?

There was a problem.

K:~ K$ sudo /opt/local/apache2/bin/apachectl start
(48)Address already in use: make_sock: could not bind to address [::]:80
(48)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down

Tell me where I made a mistake in the settings.
httpd.conf
ServerRoot "/opt/local/apache2"

Listen 80

LoadModule authn_file_module modules/mod_authn_file.so
.................................
LoadModule rewrite_module modules/mod_rewrite.so

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>

User www
Group www

</IfModule>
</IfModule>

ServerAdmin [email protected]

DocumentRoot "/opt/local/apache2/htdocs"

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory "/opt/local/apache2/htdocs">
    
    Options Indexes FollowSymLinks

    AllowOverride None

    Order allow,deny
    Allow from all

</Directory>

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

<Files ~ "^\.([Hh][Tt]|[Dd][Ss]_[Ss])">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>
<Files "rsrc">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>
<DirectoryMatch ".*\.\.namedfork">
    Order allow,deny
    Deny from all
    Satisfy All
</DirectoryMatch>

ErrorLog "logs/error_log"

LogLevel warn

<IfModule log_config_module>
    
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    CustomLog "logs/access_log" common

</IfModule>

<IfModule alias_module>
   
    ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"

</IfModule>

<IfModule cgid_module>
   
    #Scriptsock logs/cgisock
</IfModule>

<Directory "/opt/local/apache2/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

DefaultType text/plain

<IfModule mime_module>
    TypesConfig conf/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
</IfModule>

# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
......
# Virtual hosts
Include conf/extra/httpd-vhosts.conf

....
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

httpd-vhosts.conf
#
# Virtual Hosts
#
NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin [email protected]
    
    # Path to index file
    DocumentRoot "/Users/K/ws/www/"
    
    # Server URL. Must be present in /etc/hosts file
    ServerName test.dev
    
      <Directory /Users/K/ws/www/test>
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    
    # Logs
    ErrorLog "logs/test.log"
    CustomLog "logs/test-access.log" common
</VirtualHost>

hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
127.0.1.1	test.dev
255.255.255.255	broadcasthost
::1             localhost ogoltsov test.dev
fe80::1%lo0	localhost ogoltsov test.dev
.....

Actually Apache which I installed via MacPorts doesn't start -> hosts don't work either.
When requesting localhost, ogoltsov, test.dev displays the same page.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nazar Mokrinsky, 2014-10-03
@MrBe

Run:
This will show which program is already listening on port 80. Then act according to the situation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question