0

I know there is plenty of documentation about this, but my problem is different.

I have 2 websites (subdomains) running on one apache2 server.

Site 1 is working fine, site 2 is somehow linked to the apache2 directory /var/www

so when I enter Page 1 I see my page. Page 2 shows me the Apache2 text :

It works! This is the default web page for this server. The web server software is running but no content has been added, yet.

SO somewhere the link is setup wrong.

Is apache2 only listening to the pages which are in sites-enabled, or is there something more ?

Because on Sites-enabled I just have these 2 pages and NOT 1 link to /var/www Do I have to setup the different hostnames somewhere else as well ?

thanks in advance.

THIS ONE IS NOT WORKING :

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/notworking/
        ServerName notworking.working.de

       RewriteEngine on

        <Directory /var/www/notworking/>
                RailsBaseURI /notworking
                PassengerResolveSymlinksInDocumentRoot on
        </Directory>

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined
</VirtualHost>

THIS ONE IS WORKING

<VirtualHost *:80>
        ServerName working.working1.de
        DocumentRoot /data/working/www/

        <Directory /data/working/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

2 Answers 2

2

I have 2 websites (subdomains)

ServerName working.working1.de <- Working

ServerName xxx.xxxx.de <- Not working

Is it actually a subdomain the one not working? I mean since you do not post the layout of the URL, you should check out if it is an actual subdomain.

Assuming you have the domain working1.de as the working site config depicts, then your not working subdomain should be something like somesite.working1.de

Apache serves the enabled sites (/etc/apache2/sites-enabled) from the pool of available sites (/etc/apache2/sites-available) where actually are symlinks.

When you issue a2ensite mysite_config a symlink is created from sites-available to sites-enabled.

...and it is the default site configuration the one with 'It works!...' where it is enabled by default. You should disable this and keep the file as a reference for future site configurations.

EDIT

As a reference here as a Virtual Host configuration example for two subdomains hosted ad domain.de:

Accesible at http://rails.domain.de

<VirtualHost *:80>
    DocumentRoot /var/www/myrailsapp/public
    ServerName rails.domain.de

    <Directory /var/www/myrailsapp/public>
        AllowOverride all
        Options -MultiViews
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>

Accesible at http://another.domain.de

<VirtualHost *:80>
    DocumentRoot /var/www/mysite
    ServerName another.domain.de

    <Directory /var/www/mysite>
        AllowOverride all
        Options -MultiViews
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>
8
  • both are subdomains yes. I edited it.
    – Private
    Aug 23, 2013 at 9:05
  • when I try to enter the Page which is not working by url it shows me my apache2 default page. Instead linking to the correct folder.
    – Private
    Aug 23, 2013 at 9:06
  • ok i just changed my index.html in /var/www to to display different text. but it didnt change anything on my website...after restarting apache2. so it's linking to something different....
    – Private
    Aug 23, 2013 at 9:09
  • Do these entries have to be in ONE file or can that be done in 2 files? thanks
    – Private
    Aug 23, 2013 at 9:13
  • If in separate files which is better since you can enable-disable separately then you must enable them both with a2ensite site1 and a2ensiste site2 where site1 and site2 will be replaced by the name of your sites or whatever it suits you as filenames.
    – Stef K
    Aug 23, 2013 at 9:16
1

try:

DocumentRoot /var/www/mysite
ServerName another.domain.de
ServerAlias another.domain.de

<Directory /var/www/mysite>
    AllowOverride all
    Options -MultiViews
    Order allow,deny
    allow from all
</Directory>

DocumentRoot /var/www/myrailsapp/public
ServerName rails.domain.de
ServerAlias rails.domain.de

<Directory /var/www/myrailsapp/public>
    AllowOverride all
    Options -MultiViews
    Order allow,deny
    allow from all
</Directory>

also add those Hosts to your /etc/hosts on your apache server config (to clarify: add these to the "hosts" file on the server, apache is running on)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .