---
title: "Hur man skapar subdomäner i Apache"
type: "forum-thread"
url: "https://www.webforum.nu/amne/webbservrar/148071-hur-man-skapar-subdomäner-i-apache"
topic: "Webbservrar"
topic_url: "https://www.webforum.nu/amne/webbservrar"
author: "tilleritova"
published: "2006-06-14T13:49:47.000Z"
updated: "2006-06-19T07:03:12.000Z"
replies: 11
views: 896
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/webbservrar/148071-hur-man-skapar-subdomäner-i-apache"
---

# Hur man skapar subdomäner i Apache

## #1 — tilleritova, 2006-06-14T13:49Z

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?!

Permalänk: https://www.webforum.nu/p/148071

## #2 — GunnarD, 2006-06-14T14:13Z

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

Permalänk: https://www.webforum.nu/p/1829298

## #3 — jonnyz, 2006-06-14T14:17Z

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

Permalänk: https://www.webforum.nu/p/1829300

## #4 — tilleritova, 2006-06-14T14:24Z

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**

Permalänk: https://www.webforum.nu/p/1829301

## #5 — tilleritova, 2006-06-15T18:42Z

Är det alltså ingen som vet?!

Permalänk: https://www.webforum.nu/p/1829669

## #6 — GunnarD, 2006-06-15T19:15Z

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&>

Permalänk: https://www.webforum.nu/p/1829682

## #7 — tilleritova, 2006-06-15T19:31Z

fortfarande error 403...

Permalänk: https://www.webforum.nu/p/1829684

## #8 — tilleritova, 2006-06-16T18:51Z

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!

Permalänk: https://www.webforum.nu/p/1829991

## #9 — GunnarD, 2006-06-16T20:00Z

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

Permalänk: https://www.webforum.nu/p/1829996

## #10 — tilleritova, 2006-06-16T21:34Z

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

Bilagor:

- [httpdconf.txt](https://www.webforum.nu/a/11112.txt)

Permalänk: https://www.webforum.nu/p/1830014

## #11 — GunnarD, 2006-06-17T08:35Z

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

Permalänk: https://www.webforum.nu/p/1830047

## #12 — Palle, 2006-06-19T07:03Z

**Tråden flyttas från [Webbutveckling - Övrigt](http://www.webforum.nu/forumdisplay.php?f=163).**

mvh Palle
Moderator webForum

Permalänk: https://www.webforum.nu/p/1830412

---

Tråden på webben: https://www.webforum.nu/amne/webbservrar/148071-hur-man-skapar-subdomäner-i-apache
