webForumDet fria alternativet

Hur man skapar subdomäner i Apache

Webbservrar

11 svar · 862 visningar · startad av tilleritova

Medlem sedan okt. 2005112 inlägg
Frågan#1

Hej...

Hoppas detta är rätt ställe... annars får ni flytta denna tråd till rätt. ;)

Jag undrar hur man sätter upp en subdomän på en apache server...

Jag har lagt till förljande i min httpd-vhosts fil:

NameVirtualHost *:80
#This is the first VHOST for you content stoll.nu
#change the path to your pathes of content
<VirtualHost *:80>
    ServerName stoll.nu
    ServerAlias www.stoll.nu
    ServerAdmin webmaster@stoll.nu
    DocumentRoot C:/Program/xampp/htdocs/
<Directory "C:/Program/xampp/htdocs">
        AllowOverride All
        Options IncludesNoExec
        Order allow,deny
        Allow from all
</Directory>
</VirtualHost>

#This is the first SUBdomain with his own Path for content
<VirtualHost *:80>
    ServerName sub1.stoll.nu
    ServerAlias www.sub1.stoll.nu
    ServerAdmin webmaster@stoll.nu
    DocumentRoot C:/Program/xampp/htdocs/sub1stollnu/
<Directory "C:/Program/xampp/htdocs/sub1stollnu">
        AllowOverride All
        Options IncludesNoExec
        Order allow,deny
        Allow from all
</Directory>
</VirtualHost>

#This ist the next SUBdomain with own Path of content
<VirtualHost *:80>
    ServerName sub2.stoll.nu
    ServerAlias www.sub2.stoll.nu
    ServerAdmin webmaster@stoll.nu
    DocumentRoot C:/Program/xampp/htdocs/sub2stollnu/
<Directory "C:/Program/xampp/htdocs/sub1stollnu">
        AllowOverride All
        Options IncludesNoExec
        Order allow,deny
        Allow from all
</Directory>
</VirtualHost>

och så har jag tagit bort # framför Include conf/extra/httpd-vhosts.conf

men när jag har startat om servern så får jag Error 403 Access Denied när jag försöker att gå in på sidan?

min Errorlog ser ut så här:

[Wed Jun 14 15:33:59 2006] [notice] Apache/2.2.0 (Win32) DAV/2 mod_ssl/2.2.0 OpenSSL/0.9.8a mod_autoindex_color PHP/5.1.2 configured -- resuming normal operations
[Wed Jun 14 15:33:59 2006] [notice] Server built: Dec 1 2005 18:36:53
[Wed Jun 14 15:33:59 2006] [notice] Parent: Created child process 3140
[Wed Jun 14 15:34:00 2006] [notice] Child 3140: Child process is running
[Wed Jun 14 15:34:00 2006] [notice] Child 3140: Acquired the start mutex.
[Wed Jun 14 15:34:00 2006] [notice] Child 3140: Starting 250 worker threads.
[Wed Jun 14 15:34:00 2006] [notice] Child 3140: Starting thread to listen on port 443.
[Wed Jun 14 15:34:00 2006] [notice] Child 3140: Starting thread to listen on port 80.
[Wed Jun 14 15:34:02 2006] [error] [client 83.227.184.134] (20023)The given path was above the root path: Cannot map GET / HTTP/1.1 to file
[Wed Jun 14 15:34:02 2006] [error] [client 83.227.184.134] (20023)The given path was above the root path: Cannot map GET / HTTP/1.1 to file
[Wed Jun 14 15:34:02 2006] [error] [client 83.227.184.134] (20023)The given path was above the root path: Cannot map GET / HTTP/1.1 to file
[Wed Jun 14 15:34:02 2006] [error] [client 83.227.184.134] (20023)The given path was above the root path: Cannot map GET / HTTP/1.1 to file
[Wed Jun 14 15:34:02 2006] [error] [client 83.227.184.134] (20023)The given path was above the root path: Cannot map GET / HTTP/1.1 to file
[Wed Jun 14 15:34:02 2006] [error] [client 83.227.184.134] (20023)The given path was above the root path: Cannot map GET / HTTP/1.1 to file
[Wed Jun 14 15:34:02 2006] [error] [client 83.227.184.134] (20023)The given path was above the root path: Cannot map GET / HTTP/1.1 to file
[Wed Jun 14 15:34:03 2006] [error] [client 83.227.184.134] (20023)The given path was above the root path: Cannot map GET / HTTP/1.1 to file
[Wed Jun 14 15:34:03 2006] [error] [client 83.227.184.134] (20023)The given path was above the root path: Cannot map GET / HTTP/1.1 to file

Men sökvägen är inte fel... så vad är det som är fel?!

Medlem sedan juni 20014 290 inlägg
#2

Kan du posta motsvarande rader ur access_log'en så att vi ser hur requesten ser ut.

Sedan har du ett fel https://www.sub2.stoll.nu

.
.
    DocumentRoot C:/Program/xampp/htdocs/sub2stollnu/
<Directory "C:/Program/xampp/htdocs/sub1stollnu">
.
.

Rooten är satt till sub2stollnu medans i Directory hänvisas til sub2stollnu

Medlem sedan okt. 2004502 inlägg
#3

Det ser ut som du har missat att ändra <Directory "C:/Program/xampp/htdocs/sub1stollnu">
för sub2

Medlem sedan okt. 2005112 inlägg
#4

Jag ändrade så nu ser det ut:

<VirtualHost *:80>
    ServerName stoll.nu
    ServerAlias www.stoll.nu
    ServerAdmin webmaster@stoll.nu
    DocumentRoot C:/Program/xampp/htdocs/
<Directory "C:/Program/xampp/htdocs">
        AllowOverride All
        Options IncludesNoExec
        Order allow,deny
        Allow from all
</Directory>
</VirtualHost>

#This is the first SUBdomain with his own Path for content
<VirtualHost *:80>
    ServerName sub1.stoll.nu
    ServerAlias www.sub1.stoll.nu
    ServerAdmin webmaster@stoll.nu
    DocumentRoot C:/Program/xampp/htdocs/sub1stollnu/
<Directory "C:/Program/xampp/htdocs/sub1stollnu">
        AllowOverride All
        Options IncludesNoExec
        Order allow,deny
        Allow from all
</Directory>
</VirtualHost>

#This ist the next SUBdomain with own Path of content
<VirtualHost *:80>
    ServerName sub2.stoll.nu
    ServerAlias www.sub2.stoll.nu
    ServerAdmin webmaster@stoll.nu
    DocumentRoot C:/Program/xampp/htdocs/sub2stollnu/
<Directory "C:/Program/xampp/htdocs/sub2stollnu">
        AllowOverride All
        Options IncludesNoExec
        Order allow,deny
        Allow from all
</Directory>
</VirtualHost>

från min errorlog:

[Wed Jun 14 16:17:59 2006] [notice] Child 1760: Child process is running
[Wed Jun 14 16:17:59 2006] [notice] Child 1760: Acquired the start mutex.
[Wed Jun 14 16:17:59 2006] [notice] Child 1760: Starting 250 worker threads.
[Wed Jun 14 16:17:59 2006] [notice] Child 1760: Starting thread to listen on port 443.
[Wed Jun 14 16:17:59 2006] [notice] Child 1760: Starting thread to listen on port 80.
[Wed Jun 14 16:17:59 2006] [error] [client 83.227.184.134] (20023)The given path was above the root path: Cannot map GET /lankar/ HTTP/1.1 to file, referer: http://www.stoll.nu/
[Wed Jun 14 16:18:01 2006] [error] [client 83.227.184.134] (20023)The given path was above the root path: Cannot map GET /lankar/ HTTP/1.1 to file, referer: http://www.stoll.nu/
[Wed Jun 14 16:20:21 2006] [error] [client 83.227.184.134] (20023)The given path was above the root path: Cannot map GET /lankar/ HTTP/1.1 to file, referer: http://www.stoll.nu/
[Wed Jun 14 16:20:24 2006] [error] [client 83.227.184.134] (20023)The given path was above the root path: Cannot map GET / HTTP/1.1 to file
[Wed Jun 14 16:21:23 2006] [error] [client 81.225.144.241] (20023)The given path was above the root path: Cannot map GET / HTTP/1.1 to file, referer: http://www.webforum.nu/showthread.php?t=144222
[Wed Jun 14 16:21:23 2006] [error] [client 81.225.144.241] (20023)The given path was above the root path: Cannot map GET /favicon.ico HTTP/1.1 to file

...och från accesloggen:

83.227.184.134 - - [14/Jun/2006:16:20:24 +0200] "GET / HTTP/1.1" 403 1228
81.225.144.241 - - [14/Jun/2006:16:21:23 +0200] "GET / HTTP/1.1" 403 1129

men får fortfarande error 403

Medlem sedan okt. 2005112 inlägg
#5

Är det alltså ingen som vet?!

Medlem sedan juni 20014 290 inlägg
#6

Hittade denna tråden i ett annat forum om liknande problem och med en lösning http://www.apachefriends.org/f/viewtopic.php?t=17516&

Medlem sedan okt. 2005112 inlägg
#7

fortfarande error 403...

Medlem sedan okt. 2005112 inlägg
#8

när jag byter ut <VirtualHost *:80> mot <VirtualHost localhost> så kommer jag åt min huvudsida... men subdomänen funkar fortfarande inte

Fan, jag börjar ledsna snart... ska det ta en hel j****la vecka att få upp en sketen subdomän!

Medlem sedan juni 20014 290 inlägg
#9

Lägg upp hela httpd.conf så kan jag titta på den i helgen.

Medlem sedan okt. 2005112 inlägg
#10

Ok här kommer hela httpd.conf
Hoppas du hittar någonting...

Medlem sedan juni 20014 290 inlägg
#11

Tyvärr, det var inte hela, den includerar ett antal filer, bl.a. dina vhost direktiv som också skulle vara bra att se.

Det enda jag skulle kunna tänka mig är att du flyttar ut sub1.stoll.nu och sub2.stoll.nu utanför ditt htdocs katalog, ex. C:/Program/xampp/sub1stoll resp. C:/Program/xampp/sub2stoll

Medlem sedan apr. 20003 174 inlägg
#12

Tråden flyttas från Webbutveckling - Övrigt.

mvh Palle
Moderator webForum

251 ms totalt · 4 externa anrop · v20260731065814-full.86ec41c2
118 ms — deklarationer (db)
0 ms — hämta statistik (cache)
127 ms — hämta tråd, inlägg och bilagor (db)
122 ms — ändringar (db)