3

I've gone through a number of posts but none has fixed my problem, so I'm asking.

I've never setup domains or subdomains so any simple mistake could be the problem.

System:

  • Debian 6.0.6
  • apache2.2.16

What i've done so far:

  • Created an A record. (looks like it's resolving fine)
  • added a sites available config file that looks like this:

    <VirtualHost *:80>
        ServerAdmin webmaster@mores.es
        ServerName m.mores.es
    
        DocumentRoot /var/www/internet/movil/
    
       <Directory />
            Options Indexes FollowSymLinks Includes ExecCGI
            DirectoryIndex index.php index.html
    
            AllowOverride None
            Order allow,deny
            allow from all
       </Directory>
    
       ErrorLog /var/log/apache2/m.mores.es-error.log
       CustomLog /var/log/apache2/m.mores.es-access.log combined
    
    </VirtualHost>
    
  • i've run the command a2ensite m.mores.es (name of the file created in sites available)

  • restarted apache

Here, I get the forbidden error.

  • Changed folder permissions recursively to 775
  • restarted apache

I get the forbidden error.

Any clue?

EDIT apache log: This might be the key. this log appears on "other_vhosts_access.log" when on the file I set up another log file. Both access and error files for m.mores.es EXIST but are empty. this is the only log that has something with m.mores.es

m.mores.es:80 212.89.22.73 - - [15/Jun/2015:17:02:54 +0200] "GET /index.html HTTP/1.1" 403 237 "-" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
m.mores.es:80 212.89.22.73 - - [15/Jun/2015:17:02:54 +0200] "GET /index.html HTTP/1.1" 403 237 "-" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
m.mores.es:80 212.89.22.73 - - [15/Jun/2015:17:02:55 +0200] "GET /favicon.ico HTTP/1.1" 302 241 "http://m.mores.es/index.html" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
m.mores.es:80 212.89.22.73 - - [15/Jun/2015:17:02:55 +0200] "GET /favicon.ico HTTP/1.1" 302 241 "http://m.mores.es/index.html" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
m.mores.es:80 212.89.22.73 - - [15/Jun/2015:17:03:01 +0200] "GET /index.php HTTP/1.1" 302 241 "-" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
m.mores.es:80 212.89.22.73 - - [15/Jun/2015:17:03:01 +0200] "GET /index.php HTTP/1.1" 302 241 "-" "Mozilla/5.0 (Windows NT 5.1) 
  • Please post the messages in your apache log. – user219962 Jun 16 '15 at 9:12
  • 1
    try to replace <Directory /> with <Directory "/var/www/internet/movil/"> – Maxiko Jun 16 '15 at 9:44
  • @Maxiko tried that, with a2dissite, reload apache, a2ensite ande reload apache again, no changes – monxas Jun 16 '15 at 9:56
  • Check if other configurations are active in /etc/apache2/sites-enabled that might have influence or cover your vhost configuration. – Helmut Wollmersdorfer Jun 17 '15 at 13:28
  • 2
    Something is wrong causing apache to not use the correct VirtualHost for this one domain. You can check the VirtualHost configuration by running httpd -S. (One thing that can cause this is if you've edited the file on a Windows machine - it has different line breaks which create invisible extra characters at the end of the line. You can see those by running cat -v /path/to/the/virtualhost.conf.) – Jenny D Jun 21 '15 at 18:29
4
+25

You have set your DocumentRoot to /var/www/internet/movil/ but you point the directory to /. Change it to say

   <Directory /var/www/internet/movil>

Also mind to remove the trailing slashes in the paths.

The entire vhost would look like this:

<VirtualHost *:80>
    ServerAdmin webmaster@mores.es
    ServerName m.mores.es

    DocumentRoot /var/www/internet/movil

   <Directory /var/www/internet/movil>
        Options Indexes FollowSymLinks Includes ExecCGI
        DirectoryIndex index.php index.html

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

   ErrorLog /var/log/apache2/m.mores.es-error.log
   CustomLog /var/log/apache2/m.mores.es-access.log combined

</VirtualHost>

Reload apache and it should work

| improve this answer | |
0

If you happen to have SELinux enabled, that could be your culprit.

sudo vim /var/log/audit/audit.log

or sudo tail -f /var/log/audit/audit.log

and

sudo ls -Z /var/www/internet/movil/

With semanage fcontext you can then rectify this.

| improve this answer | |
  • No, selinux not enabled.... I can't work this out! – monxas Jun 18 '15 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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