FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 12-12-2011, 05:23 AM
Joseph
 
Default apache - virtual host not working

Any any body provide me with hint why my "virtual host" is not working in apache?

I've copied server config files from one computer to another.
I used "meld" to be sure most changes are accurate but when try to access virtual host:
I get:
Forbidden

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

I don't know where else to look.

In /etc/hosts I have:
127.0.0.1 localhost.localdomain localhost mydomain.ca syscon5
10.0.0.100 www.mydomain.ca

If I comment out: #10.0.0.100 www.mydomain.ca
I can access this domain.

in: modules.d/00_default_settings.conf
# We configure the "default" to be a very restrictive set of features.
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>

# added below
<Directory "/var/www/localhost/htdocs">
AllowOverride All
Order allow,deny
Allow from all
</Directory>

<FilesMatch "^.ht">
Order allow,deny
Deny from all
</FilesMatch>


I don't know where else to look. I can not access virtual domain on port 80 nor on 443
The server is working perfectly on my other computer running the same version of apache. As stated earlier I've compare configuration file with meld so I'm
sure there are no mistakes.


--
Joseph
 
Old 12-12-2011, 06:01 AM
"J. Roeleveld"
 
Default apache - virtual host not working

On Mon, December 12, 2011 7:23 am, Joseph wrote:
> Any any body provide me with hint why my "virtual host" is not working in
> apache?

We'll try

> I've copied server config files from one computer to another.

Which config-files?
I think apache uses the following:
/etc/conf.d/apache
/etc/apache/*

And is apache compiled with the same USE-flags on both machines?

> I used "meld" to be sure most changes are accurate but when try to access
> virtual host:
> I get:
> Forbidden
> You don't have permission to access / on this server.

This is either a missing/wrong configuration, or Apache does not have
access to the directory (filesystem permissions)

> I don't know where else to look.
>
> In /etc/hosts I have:
> 127.0.0.1 localhost.localdomain localhost mydomain.ca syscon5
> 10.0.0.100 www.mydomain.ca
>
> If I comment out: #10.0.0.100 www.mydomain.ca
> I can access this domain.

Does it work properly when you comment out this line?
Is the IP-adres correct?

> in: modules.d/00_default_settings.conf
> # We configure the "default" to be a very restrictive set of features.
> <Directory />
> Options FollowSymLinks
> AllowOverride None
> Order deny,allow
> Deny from all
> </Directory>
>
> # added below
> <Directory "/var/www/localhost/htdocs">
> AllowOverride All
> Order allow,deny
> Allow from all
> </Directory>
>
> <FilesMatch "^.ht">
> Order allow,deny
> Deny from all
> </FilesMatch>
>
> I don't know where else to look. I can not access virtual domain on port
> 80 nor on 443

There is a different directory where the actual websites are configured:
/etc/apache/vhosts

I am missing this in your email.

> The server is working perfectly on my other computer running the same
> version of apache. As stated earlier I've compare configuration file with
> meld so I'm sure there are no mistakes.

What does apache report in the logs?
/var/log/apache/*

--
Joost
 
Old 12-12-2011, 06:03 AM
Matthew Finkel
 
Default apache - virtual host not working

On Mon, Dec 12, 2011 at 1:23 AM, Joseph <syscon780@gmail.com> wrote:




In /etc/hosts I have:

127.0.0.1 localhost.localdomain localhost mydomain.ca syscon5

10.0.0.100 www.mydomain.ca



If I comment out: #10.0.0.100 www.mydomain.ca

I can access this domain.
*By "access", do you mean the website loads without the access restriction?*

*
in: modules.d/00_default_settings.conf

# We configure the "default" to be a very restrictive set of features.

<Directory />

* Options FollowSymLinks

* AllowOverride None

* Order deny,allow

* Deny from all

</Directory>
*Is there a reason you're giving access to / ?*




# added below

<Directory "/var/www/localhost/htdocs">

* * * *AllowOverride All

* * * *Order allow,deny

* * * *Allow from all

</Directory>



<FilesMatch "^.ht">

* Order allow,deny

* Deny from all

</FilesMatch>

Do you set the DocumentRoot within the file to a location to which the apache user has read access?*


I don't know where else to look. I can not access virtual domain on port 80 nor on 443

The server is working perfectly on my other computer running the same version of apache. As stated earlier I've compare configuration file with meld so I'm sure there are no mistakes.





--

Joseph




Hope we can get this resolved.- Matt
--
Matthew Finkel
 
Old 12-12-2011, 06:12 AM
"J. Roeleveld"
 
Default apache - virtual host not working

On Mon, December 12, 2011 8:03 am, Matthew Finkel wrote:
> On Mon, Dec 12, 2011 at 1:23 AM, Joseph <syscon780@gmail.com> wrote:
>> in: modules.d/00_default_settings.**conf
>> # We configure the "default" to be a very restrictive set of features.
>> <Directory />
>> Options FollowSymLinks
>> AllowOverride None
>> Order deny,allow
>> Deny from all
>> </Directory>
>
> Is there a reason you're giving access to / ?

This is a default setting in that file.
It actually prevents access to "/" (Which is should do)

The correct access should be configured in a file in:
/etc/apache/vhosts.d/...

--
Joost
 
Old 12-12-2011, 06:21 AM
Joseph
 
Default apache - virtual host not working

On 12/12/11 02:03, Matthew Finkel wrote:

On Mon, Dec 12, 2011 at 1:23 AM, Joseph <syscon780@gmail.com> wrote:

In /etc/hosts I have:
127.0.0.1 localhost.localdomain localhost mydomain.ca syscon5
10.0.0.100 www.mydomain.ca

If I comment out: #10.0.0.100 www.mydomain.ca
I can access this domain.


By "access", do you mean the website loads without the access restriction?





in: modules.d/00_default_settings.conf
# We configure the "default" to be a very restrictive set of features.
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>


Is there a reason you're giving access to / ?


No the above statement actually prevent access, am I correct?

Thanks folks, SOLVED!

Another lesson learned.
I went for easy way out, tar.gz /var/* directory copy it to another machine.

Mistake #1
Extracted the file on the other machine as user (mistake #1) all the owner ship of file got changed to joseph:joseph

Mistake #2
I use "meld" to compare the directors and copy missing files and directories to the destination machine. Meld - does not preserve owner-ship either.


The reason it didn't work as .htaccess file were changed to owner ship root:root and it should be apache:apache.
So the solution was to use "rsync -av" it preserver owner ship and permission :-/

Another lessor learned!

--
Joseph
 
Old 12-12-2011, 06:26 AM
"J. Roeleveld"
 
Default apache - virtual host not working

On Mon, December 12, 2011 8:21 am, Joseph wrote:
> On 12/12/11 02:03, Matthew Finkel wrote:
>> On Mon, Dec 12, 2011 at 1:23 AM, Joseph <syscon780@gmail.com> wrote:
>>
>> In /etc/hosts I have:
>> 127.0.0.1 localhost.localdomain localhost mydomain.ca syscon5
>> 10.0.0.100 www.mydomain.ca
>>
>> If I comment out: #10.0.0.100 www.mydomain.ca
>> I can access this domain.
>>
>>
>> By "access", do you mean the website loads without the access
>> restriction?
>>
>>
>>
>>
>> in: modules.d/00_default_settings.conf
>> # We configure the "default" to be a very restrictive set of
>> features.
>> <Directory />
>> Options FollowSymLinks
>> AllowOverride None
>> Order deny,allow
>> Deny from all
>> </Directory>
>>
>>
>> Is there a reason you're giving access to / ?
>
> No the above statement actually prevent access, am I correct?

Yes, you are correct. It prevents access.
Configuration in the vhosts-config will add access to the required
directories.

> Thanks folks, SOLVED!

That's good to hear.

> Another lesson learned.
> I went for easy way out, tar.gz /var/* directory copy it to another
> machine.

The "-p" option will preserve ownership and permissions. You need to add
it to both compressing and extracting.

> Mistake #1
> Extracted the file on the other machine as user (mistake #1) all the owner
> ship of file got changed to joseph:joseph
>
> Mistake #2
> I use "meld" to compare the directors and copy missing files and
> directories to the destination machine. Meld - does not preserve
> owner-ship either.
>
> The reason it didn't work as .htaccess file were changed to owner ship
> root:root and it should be apache:apache.
> So the solution was to use "rsync -av" it preserver owner ship and
> permission :-/
>
> Another lessor learned!

We always learn new things.

--
Joost
 
Old 12-12-2011, 06:56 AM
Matthew Finkel
 
Default apache - virtual host not working

On Mon, Dec 12, 2011 at 2:26 AM, J. Roeleveld <joost@antarean.org> wrote:


On Mon, December 12, 2011 8:21 am, Joseph wrote:

> On 12/12/11 02:03, Matthew Finkel wrote:

>> * On Mon, Dec 12, 2011 at 1:23 AM, Joseph <syscon780@gmail.com> wrote

>>

>> * * in: modules.d/00_default_settings.conf

>> * * # We configure the "default" to be a very restrictive set of

>> features.

>> * * <Directory />

>> * * * Options FollowSymLinks

>> * * * AllowOverride None

>> * * * Order deny,allow

>> * * * Deny from all

>> * * </Directory>

>>

>>

>> * Is there a reason you're giving access to / ?

>

> No the above statement actually prevent access, am I correct?



Yes, you are correct. It prevents access.

Configuration in the vhosts-config will add access to the required

directories.
*I'm sorry, I skimmed over it and misread it. It's much better the way you have it! *




> Thanks folks, SOLVED!



That's good to hear.



> Another lesson learned!

*Awesome! Live and learn
- Matt
 
Old 12-12-2011, 08:22 AM
Neil Bothwick
 
Default apache - virtual host not working

On Mon, 12 Dec 2011 08:26:55 +0100, J. Roeleveld wrote:

> > Another lesson learned.
> > I went for easy way out, tar.gz /var/* directory copy it to another
> > machine.
>
> The "-p" option will preserve ownership and permissions. You need to add
> it to both compressing and extracting.

That's the default anyway, but it only works if you extract as root or
the user that owns the files.


--
Neil Bothwick

WinErr 042: Virus error - A virus has been activated in a dos-box. The
virus, however, requires Windows. All tasks will automatically be closed
and the virus will be activated again.
 

Thread Tools




All times are GMT. The time now is 04:40 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org