R
R
romamartynov2014-06-06 02:18:27
Apache HTTP Server
romamartynov, 2014-06-06 02:18:27

How to fix 403 error with some name-based sites on apache?

I have Mac, Apache, several name-based virtual hosts, and a very strange problem.
In the main directory (reassigned in the configurations to /Users/roma/Sites ) there are two folders, each with its own project files. Both are described in the /etc/apache2/users/roma.conf file :

<Directory "/Users/roma/Sites/">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>

NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
    ServerName "localhost"
    DocumentRoot "/Users/roma/Sites"
    <Directory "/Users/roma/Sites">
        Allow From All
        AllowOverride All
    </Directory>
</VirtualHost>

<VirtualHost 127.0.0.1:80>
    ServerAdmin [email protected]
    DocumentRoot "/Users/roma/Sites/cookieseo.dev"
    ServerName cookieseo.dev
    <Directory "/Users/roma/Sites/cookieseo.dev">
        AllowOverride All
        Allow From all
    </Directory>
</VirtualHost>

<VirtualHost 127.0.0.1:80>
    ServerAdmin [email protected]
    DocumentRoot "/Users/roma/Sites/designlikeme.dev"
    ServerName designlikeme.dev
    <Directory "/Users/roma/Sites/designlikeme.dev">
        AllowOverride All
        Allow From all
    </Directory>
</VirtualHost>

Similar configuration in /etc/apache2/extra/httpd-vhosts.conf :
Listen 80
NameVirtualHost *:80

<VirtualHost *:80>
   DocumentRoot /Users/roma/Sites
</VirtualHost>

<VirtualHost *:80>
   DocumentRoot /Users/roma/Sites/designlikeme.dev
   ServerName designlikeme.dev
   ServerAlias designlikeme.dev
</VirtualHost>

<VirtualHost *:80>
   DocumentRoot /Users/roma/Sites/cookieseo.dev
   ServerName cookieseo.dev
   ServerAlias cookieseo.dev
</VirtualHost>

And both domains are added to /etc/hosts :
127.0.0.1 cookieseo.dev
127.0.0.1 designlikeme.dev

Run sudo chmod 755 on the entire /Users/roma/Sites
directory. Issue sudo apachectl -S :
VirtualHost configuration:
127.0.0.1:80           is a NameVirtualHost
         default server localhost (/private/etc/apache2/users/roma.conf:10)
         port 80 namevhost localhost (/private/etc/apache2/users/roma.conf:10)
         port 80 namevhost cookieseo.dev (/private/etc/apache2/users/roma.conf:19)
         port 80 namevhost designlikeme.dev (/private/etc/apache2/users/roma.conf:29)
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server localhost (/private/etc/apache2/extra/httpd-vhosts.conf:30)
         port 80 namevhost localhost (/private/etc/apache2/extra/httpd-vhosts.conf:30)
         port 80 namevhost designlikeme.dev (/private/etc/apache2/extra/httpd-vhosts.conf:34)
         port 80 namevhost cookieseo.dev (/private/etc/apache2/extra/httpd-vhosts.conf:40)
Syntax OK

And as a result, the site cookieseo.dev opens in the browser, and displays the contents of the folder with the project files, and designlikeme.dev returns 403.
In addition, in the browser, when you go to 127.0.0.1, only one folder is also displayed - the one of the project that is running as per your link.
51a31ab939e14d43b50ec83826308cd6.png
What could be the problem? In which direction to dig?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2014-06-06
@merryjane

Show output
ls -l /Users/roma/Sites

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question