I am new to Apache.

I am editing the httpd.config to point virtual host to a specific filesystem location.

Here is what I am trying:

127.0.0.1

DocumentRoot "/Users/MyUser/Documents/StoreFront"

Alias StoreFront /Users/MyUser/Documents/StoreFront

<Directory /Users/MyUser/Documents/StoreFront>
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

I cannot restart the server after making these changes. I get the following errors:

/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument
Syntax error on line 161 of /private/etc/apache2/httpd.conf:
Invalid command '127.0.0.1', perhaps misspelled or defined by a module not included in the server configuration
httpd not running, trying to start

Can someone help me out?

Update

I have the following now:

This is what my hosts file looks like:

    # 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
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost

This is the virtualhost I have in my httpd.config:

<VirtualHost 127.0.0.1>
    DocumentRoot "/Users/Nick/Documents/StoreFront"
    ServerName localhost
  <Directory "/Users/Nick/Documents/StoreFront">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

After making these changes I am trying to restart the server with following:

apachectl -k restart

Error:

/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument httpd not running, trying to start (13)Permission denied: make_sock: could not bind to address [::]:80 (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs

link|improve this question

40% accept rate
2  
belongs on serverfault.com – Daniel A. White Mar 20 '11 at 0:14
Well, are you root? – bahamat Mar 20 '11 at 2:36
Ahh.. you think the process does not have permissions to run perhaps? – Nick Mar 20 '11 at 3:52
feedback

migrated from stackoverflow.com Mar 20 '11 at 0:40

This question came from our site for professional and enthusiast programmers.

4 Answers

(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs

You are not root.

You must be root to start or stop apache.

link|improve this answer
Seems likely adaptr has it here. – SuperBOB Apr 24 at 12:37
feedback

It should be ServerName 127.0.0.1

link|improve this answer
Thanks.. but I got the same error. Tried: localhost 127.0.0.1 – Nick Mar 20 '11 at 0:29
@Nick: Neither 127.0.0.1 nor localhost 127.0.0.1 are valid commands in the configuration. The ServerName part is supposed to stay that way (i.e. that is the command name). – poke Mar 20 '11 at 0:42
No, really ServerName, the characters "S", then "e" and so on. You are trying to say "The ServerName is 127.0.0.1" not "localhost is 120.0.0.1". – Quentin Mar 20 '11 at 9:02
feedback

An IP isn't the server name.

This is what i use in my local setup:

<VirtualHost *:80>
    DocumentRoot "/Users/dan/htdocs/mysite.net/www"
    ServerName mysite.local
  <Directory "/Users/dan/htdocs/mysite.net">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

Then in my hosts file i have this line:

127.0.0.1 mysite.local

My setup above is for OS X, but i also have the same exact setup other then file paths for a windows xp machine.

link|improve this answer
What do you mean by hosts file? Not the httpd.config? – Nick Mar 20 '11 at 0:49
I am also running os x btw – Nick Mar 20 '11 at 0:49
/etc/hosts file. It like a local DNS – dbers Sep 15 '11 at 16:07
feedback

Also if you want to figure the virtualhost to serve only to localhost (i.e you can visit it by going to 127.0.0.1 from the same box, but not from any external ip) use the following config line.

Listen 127.0.0.1:80
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.