Jump to content

Virtual host on Apache.


Guest tcreek
 Share

Recommended Posts

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

Or even give me some tips. I want another web site on the same IP. I went to LinuxConf to setup Apache and click on Virtual host to set up another web/domain.

 

When I try the access that site from a browser I get

 

"You don't have permission to access / on this server."

 

However the site is not located at /

 

I make a new directory in /var/www

 

Thanks,

 

Trent

Link to comment
Share on other sites

the default install of apache uses /var/www so it should have been created

in /etc/http/conf/vhost/Vhost.conf you will se how virtual hosting works, its pretty well documented.

You created /var/www ? it should already exist after apache installation.

"You don't have permission to access / on this server."

 

However the site is not located at /

 

I make a new directory in /var/www 

you're right ... the webroot is /var/www/html but apache refers to it as / because it is the webroot (read: the apache root directory)

Link to comment
Share on other sites

I set the virtual web site at /var/www/calandria

And set it for the default document in the Apache setup in LinuxConf.

 

So you are saying I need to set the virtual site in /etc/http/conf/vhost/Vhost.conf?

Link to comment
Share on other sites

[paul@morpheus paul]$ ls /etc/httpd/conf/vhosts/

DynamicVhosts.conf  Vhosts.conf  VirtualHomePages.conf

[paul@morpheus paul]$

 

[paul@morpheus paul]$ cat /etc/httpd/conf/vhost

~~~~~ I've shortened this to show only the good bits ~~~~

NameVirtualHost 202.27.218.97

<VirtualHost 202.27.218.97>

       DocumentRoot /var/www/html/loudas.com

       ServerName loudas.com

       ServerAlias www.loudas.com

       CustomLog logs/loudas.com-access_log combined

</VirtualHost>

 

also you might need to look at the common file

[paul@morpheus paul]$ cat /etc/httpd/conf/commonhttpd.conf

~~~~~~~ this is also shortened for the sake of this post ~~~~~

<Directory /var/www/html/loudas.com>

   Options Indexes FollowSymLinks MultiViews

   AllowOverride All

   Order allow,deny

   Allow from all

</Directory>

if you change the default directory (which you have to /var/www/calandria ) then you will need to add something like the above to your commonhttpd.conf file

Link to comment
Share on other sites

This is what I got so far:

 

Vhosts.confs

 

################# Named VirtualHosts

NameVirtualHost 66.25.242.26

<VirtualHost 66.25.242.26>

ServerName calandria.dynu.com

#ServerPath /domain

ServerAlias www.calandria.com

DocumentRoot /var/www/calandria

</VirtualHost>

 

commonhttpd.conf

 

<Directory /var/www/calandria>

Options Indexes FollowSymLinks MultiViews

AllowOverride All

Order allow,deny

Allow from all

</Directory>

 

I restarted Apache and I still get the result as I indicated

Link to comment
Share on other sites

Make sure that the directory /var/www/calandria has the same permissions and ownership as the other site's directory that works. That's all I can think of. I didn't want to go through the hassle of configuring everything for /var/www so I changed my Apache root to /home/*/html/ (but I'm not saying you have to) And, not to insult your intelligence or anything, but if there is not an index (index.html, index.htm, etc) file in there you'll get that error.

Link to comment
Share on other sites

yep Steve is right

for security purposes your /var/www/calandria should be owned by apache, and 755'ed

chown -R apache.apache /var/www/calandria

chmod -R 755 /var/www/calandria

but for ease of use (no one listen this is a secret :#: )

I have

chown -R paul.paul /var/www/html/loudas.com

that way I can work without having to su

Link to comment
Share on other sites

I did this.....

 

[root@netservisity calandria]# chown -R apache.apache /var/www/calandria

[root@netservisity calandria]# chmod -R 755 /var/www/calandria

 

 

and...

 

same result

 

 

Trent

Link to comment
Share on other sites

I don't beleive so. In the past I have set up new sites on the www directory .

 

e.g. /var/www/trent

 

then using the domain type in

 

www.domain.com/trent

 

it would come up fine.

 

But I will try this

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share


×
×
  • Create New...