Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

apache2 vhost config problems/questions [solved]

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
10 posts • Page 1 of 1
Author
Message
Mgiese
Veteran
Veteran
User avatar
Posts: 1638
Joined: Wed Mar 23, 2005 5:25 pm
Location: indiana
Contact:
Contact Mgiese
Website

apache2 vhost config problems/questions [solved]

  • Quote

Post by Mgiese » Fri Mar 19, 2010 1:57 am

hi there,

i got 2 dyndns adresses : test1.dyndns.org and test2.dyndns.org for example

i want to point

test1.dyndns.org to /var/www/localhost/htdocs
and
test2.dyndns.org to /var/www/localhost/htdocs/test2

my /etc/apache2/vhosts.d/00_default_vhosts.conf looks like this :

Code: Select all

# Host test1.dyndns.org
<VirtualHost *:80>
    DocumentRoot /var/www/localhost/htdocs/
ServerName test1.dyndns.org
</VirtualHost>

# Host test2.dyndns.org
<VirtualHost *:80>
    DocumentRoot /var/www/localhost/htdocs/test2
ServerName test2.dyndns.org
</VirtualHost>

but i am just receiving this error message either i use test1 or test2

Code: Select all

Forbidden

You don't have permission to access / on this server.
Apache Server at test1.dyndns.org Port 80
or

Code: Select all

Forbidden

You don't have permission to access / on this server.
Apache Server at test2.dyndns.org Port 80

can someone give me a hint ?


thanks in advance
Last edited by Mgiese on Fri Mar 19, 2010 5:11 pm, edited 1 time in total.
I do not have a Superman complex, for I am God not Superman :D

Ryzen9 7950x (powersave governor) ; Radeon 9070 XT ; kernel 6.18.4 ; XFCE ; SYSTEMD
Top
DawgG
l33t
l33t
User avatar
Posts: 880
Joined: Wed Sep 17, 2003 12:31 pm

  • Quote

Post by DawgG » Fri Mar 19, 2010 9:34 am

looks like dns and vhosts work ok, you just have to set up the permissions correctly (on the local dirs that contain the files for the web-content. i think the owner should be apache2 and the permissions 755 for testing. then take away as much as possible. for just serving "static" content read is enough, but for scripting languages execute must also be allowed.
for testing you can just put a small textfile in the webdirs and request it by its name with the browser, eg http://test2.dyndns.org/textfile
there is other tings you have to consider in your apache-config, eg is directory-listing allowed etc.
the cloesly check apache's logs and soon everything will work.
GOOD LUCK!
DUMM KLICKT GUT.
Top
Mgiese
Veteran
Veteran
User avatar
Posts: 1638
Joined: Wed Mar 23, 2005 5:25 pm
Location: indiana
Contact:
Contact Mgiese
Website

  • Quote

Post by Mgiese » Fri Mar 19, 2010 11:22 am

hi there, i honestly doubt that this is my problem ...

my configuration before was ONLY for "test1.dyndns.org" and it was pointing to "/var/www/localhost/htdocs" and it worked without any user right problems (but i did not use the vhosts, since it was not necessary for a single host, just used the default apache config) . i did'nt change a thing...

in both directories are index.html files

/var/...../htdocs/index.html

/var/.../htdocs/test2/index.html


any more suggestions ? thanks a lot !



btw : the user of all files in the htdocs dir is root .. and it worked flawlessly ..
I do not have a Superman complex, for I am God not Superman :D

Ryzen9 7950x (powersave governor) ; Radeon 9070 XT ; kernel 6.18.4 ; XFCE ; SYSTEMD
Top
malern
Apprentice
Apprentice
User avatar
Posts: 170
Joined: Thu Oct 19, 2006 2:49 pm

  • Quote

Post by malern » Fri Mar 19, 2010 2:16 pm

Try adding

Code: Select all

NameVirtualHost *:80
to the start of your /etc/apache2/vhosts.d/00_default_vhosts.conf file.

If that doesn't work then check /var/log/apache/error_log for clues. What version of apache are you using?
Top
eXess
Apprentice
Apprentice
Posts: 243
Joined: Sun Aug 17, 2003 2:21 pm
Location: Belgium

  • Quote

Post by eXess » Fri Mar 19, 2010 2:21 pm

There is a limitation in Apache 2.x that prevents the DocumentRoot of one Named Virtual Host to be inside the DocumentRoot of another Named Virtual Host. That could be the source of the problem you encounter with your "test2" website. For the "test" website, I really have no clue except the standard ones:
- Did you check ownership/permissions on the files and directories in the DocumentRoot ?
- Did you write <Directory> statements in Apache config files to allow user access to the files ?
- Do you use other modules / extensions we should know of, such as SUExec or others ?

If you want further help, it would be good if you could post your config files (beginning with httpd.conf) and additional information about version, modules, etc.
. . . . . . . .
eXess
Top
disi
Veteran
Veteran
User avatar
Posts: 1354
Joined: Fri Nov 28, 2003 4:33 am
Location: Out There ...

  • Quote

Post by disi » Fri Mar 19, 2010 2:40 pm

Just set the permissions via <directory> in the config like:

Code: Select all

# Host test1.dyndns.org
<VirtualHost *:80>
DocumentRoot /var/www/localhost/htdocs/
ServerName test1.dyndns.org
<Directory /var/www/localhost/htdocs/>
Order Deny,Allow
Allow from All
</Directory>
</VirtualHost> 
You don't use .htaccess somewhere burried in the folders?
Gentoo on Uptime Project - Larry is a cow
Top
Mgiese
Veteran
Veteran
User avatar
Posts: 1638
Joined: Wed Mar 23, 2005 5:25 pm
Location: indiana
Contact:
Contact Mgiese
Website

  • Quote

Post by Mgiese » Fri Mar 19, 2010 5:11 pm

disi wrote:Just set the permissions via <directory> in the config like:

Code: Select all

# Host test1.dyndns.org
<VirtualHost *:80>
DocumentRoot /var/www/localhost/htdocs/
ServerName test1.dyndns.org
<Directory /var/www/localhost/htdocs/>
Order Deny,Allow
Allow from All
</Directory>
</VirtualHost> 
You don't use .htaccess somewhere burried in the folders?
THX a lot that did the trick !
I do not have a Superman complex, for I am God not Superman :D

Ryzen9 7950x (powersave governor) ; Radeon 9070 XT ; kernel 6.18.4 ; XFCE ; SYSTEMD
Top
Mgiese
Veteran
Veteran
User avatar
Posts: 1638
Joined: Wed Mar 23, 2005 5:25 pm
Location: indiana
Contact:
Contact Mgiese
Website

  • Quote

Post by Mgiese » Fri Mar 19, 2010 10:37 pm

what kind of directive do i need to specify a specific website/dir for ip adresses ? right now, test1.dyndns.org and test2.dyndns.org point to their specified location but if i try to reach the ip adress on which the apache runs i see the website of test1.dyndns.org... ?!?!
I do not have a Superman complex, for I am God not Superman :D

Ryzen9 7950x (powersave governor) ; Radeon 9070 XT ; kernel 6.18.4 ; XFCE ; SYSTEMD
Top
eXess
Apprentice
Apprentice
Posts: 243
Joined: Sun Aug 17, 2003 2:21 pm
Location: Belgium

  • Quote

Post by eXess » Sat Mar 20, 2010 7:59 am

Use Apache docs !
http://httpd.apache.org/docs/2.0/vhosts/ip-based.html

And don't forget to update your Listen directive so that Apache listens on all IP addresses (Listen *:80 or Listen * is generally not a good idea, security-wise)
. . . . . . . .
eXess
Top
eXess
Apprentice
Apprentice
Posts: 243
Joined: Sun Aug 17, 2003 2:21 pm
Location: Belgium

  • Quote

Post by eXess » Sat Mar 20, 2010 8:04 am

Addendum to my previous post : I don't get what you want to do.

How can Apache tell which sub/virtual host you are trying to reach if you are just typing the IP address?? Right now, typing test1.dyndns.org or test2.dyndns.org results in your web browser resolving the IP, then connecting to that IP on port 80, then telling (at the server request) what is the name of the host it's trying to reach. If you type the IP in the browser, You would directly reach the host, and when the server requests the hostname, answer with the IP address, which the server does not understand and therefore it would display the default vhost (probably located in /var/www/htdocs/localhost or something like that)...

You might want to assign multiple IP addresses to the machine (which requires quite a bit of network configuration) or multiple NICs (even worse) or use port-based virtual hosts, or use port forwarding in your router then multple IP-addresses on your host...

If you really want to do that, we'll need more info...
. . . . . . . .
eXess
Top
Post Reply

10 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic