Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7957349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:14:14+00:00 2026-06-04T04:14:14+00:00

After reading through various tutorials [1] I still can’t get my VirtualHost settings to

  • 0

After reading through various tutorials [1] I still can’t get my VirtualHost settings to work as desired. I’m getting a 403 Forbidden when I try to use a VirtualHost with a directory below my user directory as its DocumentRoot.

What I’ve done so far

  • Created file /etc/apache2/sites-available/workspace with following content:

    NameVirtualHost *:80
    <VirtualHost *:80>
        ServerName project-site
        DocumentRoot /home/user/Workspace/project/site
    </VirtualHost>
    
  • Edited file /etc/hosts now yielding:

    127.0.0.1   localhost
    127.0.1.1   my-machine
    
    # The following lines are desirable for IPv6 capable hosts
    ::1     ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    
    # VirtualHosts added by me
    127.0.0.1   project-site
    
  • Enabled virtual hosts using sudo a2ensite workspace

  • Restarted Apache using sudo services apache2 restart
  • Tried opening http://project-site and http://project-site/test.html (where test.html is present in /home/user/Workspace/project/site/) in my webbrowser

What happens

  • Restarting Apache I get the following messages on the command line:

    * Restarting web server apache2
    apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
    [Sun May 13 10:33:37 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
    [ OK ]
    
  • Opening either http://project-site or http://project-site/test.html a “403 Forbidden” is served.

What should happen

I’d like to have the contents of /home/user/Workspace/project/site being served when I browse to http://project-site.

What I learned so far

From reading similar questions on this site I learned that this is probably a permission problem [2]. Files in /home/user/Workspace/project/site might not be readable by www-data. But how do I know or correct this?

Furthermore .htaccess files were mentioned [3] being located in

/home/.htaccess
/home/user/.htacces
[...]
/home/user/path/to/project/.htaccess

and possibly not readable. I never created them, I don’t want them, will I need them?

The second answer to another question [4] made me use NameVirtualHost responsible for the warning on restart of Apache. Is it necessary and if, how do I use it properly?

Any help is much appreciated! Tell me, if you need to know anything else to locate the problem.


Ressources

  1. http://www.thegeekstuff.com/2011/07/apache-virtual-host/, http://httpd.apache.org/docs/2.2/vhosts/name-based.html, http://mintarticles.com/read/software-articles/multiple-virtual-hosts-in-xampplampp-in-ubuntu,977/, http://www.pgorecki.pl/content/virtual-host-na-localho%C5%9Bcie-apache-ubuntu, ...
  2. Apache VirtualHost 403 Forbidden
  3. Ubuntu, Apache, virtualhost and Access forbidden
  4. VirtualHost configuration
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:14:15+00:00Added an answer on June 4, 2026 at 4:14 am

    I found the following solution, not satisfying me, but solving my primary problem. Indeed it is about permissions like suggested in [1]. My /home/user directory was not accessible to the webserver. In order to grant minimal possible permissions I used

    chmod 701 /home/user
    

    to make it accessible. Additionally I recursively gave group ownership to www-data for the webroot of the virtual host like recommended in [2], but I’m not sure, whether this is necessary.

    sudo chown -R user:www-data /home/user/Workspace/project/site
    sudo chmod -R g+s /home/user/Workspace/project/site
    

    I’m going to ask for a more elegant solution in a separate question.

    Regarding the other problems mentioned, I found out the following with the help of [3] besides other resources:

    • It is not necessary and may cause an error to have NameVirtualHost *:80 in the virtual hosts description, if it appears in one of apaches other configuration files.
    • To let apache know about its fully qualified domain name being localhost one creates a file /etc/apache2/conf.d/fqdn with content ServerName localhost.

    1. https://stackoverflow.com/a/7576526/948404
    2. https://stackoverflow.com/a/9133067/948404
    3. https://help.ubuntu.com/community/ApacheMySQLPHP
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After reading through several Q/A, I still can't find a suitable answer for my
After reading this question and through the various Phone Book sorting scenarios put forth
After reading various posts and SO questions, I understand that If we have very
After reading through the pub/sub project sample in MassTransit, it left me scratching my
after reading through a couple similar Qs/As I haven't quite found the solution I'm
So I'm trying to do something extremely simple, and after reading through forums, and
E-Texteditor recently announced going open-source with their open company model. However after reading through
I saw this article pop-up in my MSDN RSS feed, and after reading through
I've been wondering about this for a while after reading through an interesting article
After reading through many of the questions here about DB schema migration and versions,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.