Quantcast
Viewing all articles
Browse latest Browse all 10

Apache Virtual Hosts and subdomains

Image may be NSFW.
Clik here to view.
Question

I’m trying to create a subdomain for a project i’m working on, projectx.cairocubicles.com, this url points to another server than the one hosting www.cairocubicles.com. The server the subdomain is pointing to has apache installed with the following virtual host:

    <VirtualHost *:80>
  # Admin email, Server Name (domain name) and any aliases
  ServerAdmin webmaster@cairocubicles.com
  ServerName  www.project1.cairocubicles.com  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /home/project1/web/public
    <Directory /home/project1/web/public>
        Options Indexes FollowSymLinks
        AllowOverride All
        AcceptPathInfo On
        Order allow,deny
        Allow from all
    </Directory>  # Custom log file locations
  LogLevel warn
  ErrorLog  /home/project1/web/log/error.log
  CustomLog /home/project1/web/log/access.log combined</VirtualHost>

But now when browsing to project1.cairocubicles.com i get a different website (another website in the virtual host lists). I also tried changing ServerName www.project1.cairocubicles.com to ServerName project1.cairocubicles.com but then i got a 403 Forbidden error. Any clues?

Thanks.

Asked by Yehia A.Salam

Image may be NSFW.
Clik here to view.
Answer

so it worked now when i gave the home directory in /home/userx a o+x permission, is this safe, why does it need the execute permission for everyone

I needed to make sure I have modified the ownership and group information on the folders, with the following command: chown apache2 /home/project1/public -R and chgrp apache2 /home/project1/public -R if the commands say that the user apache2 doesn’t exist, replace it with httpd. This is the reason why its not working in the home directory (owned by your user) and working in the /var/www directory (owned by apache2). I would recommend creating a symbolic link in /var/www/ pointing to your home directory. It is the standard thing to do. (easier for others to see whats going on)

Answered by Yehia A.Salam

Viewing all articles
Browse latest Browse all 10

Trending Articles