Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have lampp and wordpress installed correctly. When I attempt to navigate to http://localhost/phpmyadmin I get a 403 permission denied error. I can access the two sites available in my virtual host configurations. Though I'm not completely sure of what all options do in my virtual host configuartion files so I think that they mess up something for phpmyadmin. E.g. when I navigate to localhost I get the following error message which probably means that I've done something wrong (there isn't any wordpress installation linked in /var/www/):

"Neither /etc/wordpress/config-localhost.php nor /etc/wordpress/config-localhost.php could be found. Ensure one of them exists, is readable by the webserver and contains the right password/username."

My two sites are available in /var/www/ and the file system layout looks like this:

-site1
---web (public html - symbolic link to /usr/share/wordpress)
---uploads
-site2
---web (public html - symbolic link to /usr/share/wordpress)
---uploads

phpmyadmin has been installed through the Ubuntu 12.04 repositories, just like everything else, and was automatically configured during install (which should make it available by just navigating to http://localhost/phpmyadmin/ but I probably broke that while configuring the rest.)

And this is how I've configured the virtual host (the settings apply to both sites, just different domains):

<VirtualHost *:80>
    ServerAdmin site1@gmail.com
    ServerName site1.com
    ServerAlias www.site1.com

    ErrorLog /var/log/apache2/site1.com/error.log
    CustomLog /var/log/apache2/site1.com/access.log combined

    DocumentRoot /var/www/site1.com/web
    <Directory />
        Options -Indexes FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options -Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    #ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    #CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options -Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>
</VirtualHost>

If you have any comments regarding this configuration besides what's needed to make phpmyadmin work please tell me them as well :)

All help is highly appreciated! Thank you very much!

share|improve this question

2 Answers 2

up vote 0 down vote accepted

What I did to solve the issue was to change <Directory /var/www/> to <Directory /var/www/site1.com/web/>. Then both my sites worked and even phpmyadmin. I guess I had misunderstood what the use of <Directory> was for.

The answer I received didn't solve this for me or I couldn't understand the explanation correctly and if that is the case, I'm sorry. Thank you for your assistance Marty! :)

share|improve this answer

I believe your problem is with the line DocumentRoot /var/www/site1.com/web. This sets the root to be the web folder in site1.com, so nothing below that can be accessed. Document root should be set to /var/www in your case, although it can be whatever you want. The directory usually matches that for at least one entry, but you can have more Directory entries for more sites.

For example, to add site1.com, you would add another entry like this:

<VirtualHost *:80>
    <Directory /var/www/site1.com/web>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
    DocumentRoot /var/www/site1.com/web
    ServerName site1.com
</VirtualHost>

This entry can be at the end of the file, added to the existing entries

share|improve this answer
1  
I'm not sure I understand. Shouldn't the documentRoot be the root director of my website? the index-file is located in /var/www/site1.com/web and the respective file for site2 is in /var/www/site2.com/web. If I set the root of the site to be in /var/www wouldn't there be a conflict there where you can access the other site's files (if I had permission issues)? Would you like to explain the difference between Directory and DocumentRoot? –  Niklas Oct 8 '12 at 9:18
    
Yes, but if you are only going to have a single documentRoot, then everything else must be a subdomain of that website, including PHPMyAdmin, such as site1.com/phpmyadmin. My example actually instructs you to have two document roots, the original from the root directory, and another from the site1.com/web directory. Apache looks at the name of the site to figure out which one to use. –  Marty Fried Oct 8 '12 at 17:28
    
Correction: I meant subdirectory, not subdomain in my comment. –  Marty Fried Oct 10 '12 at 19:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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