Php – How to configure apache server with localhost virtual host

apache-2.2PHP

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

Best Answer

(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.

Related Topic