1

First: I am pretty new to Linux/Apache

My problem: I am trying to acces my forum via the subdomain forum.lumix-transporte.de. Usually you can acess it with lumix-transporte.de/forum.

My forum.conf file:

<VirtualHost *:80>

        ServerName forum.lumix-transporte.de
        ServerAdmin [email protected]

        DocumentRoot /var/www/forum

        <Directory /var/www/forum>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
        </Directory>

</VirtualHost>

When I am trying to access the forum with forum.lumix-transporte.de I am being redirected lumix-transporte.de so to the default Apache2 page "It works!". Also the Icon of the Software is shown in the Tab.

default file in /etc/apache2/sites-available:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

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

        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

After executing the 2 commands that were suggested by jacek.ciach 3:

root@lumix-transporte:/etc/apache2# grep -R Redirect *
root@lumix-transporte:/etc/apache2# grep -R lumix-transporte.de *
sites-available/default:        ServerName lumix-transporte.de
sites-available/forum.conf:     ServerName forum.lumix-transporte.de
sites-available/forum.conf:     ServerAdmin [email protected]
sites-enabled/forum.conf:       ServerName forum.lumix-transporte.de
sites-enabled/forum.conf:       ServerAdmin [email protected]
sites-enabled/000-default:      ServerName lumix-transporte.de

//After changing via phpmyadmin in the database wcf, the table wcf1_application and changing the domainpath from /forum to / and the domainname from lumix-transporte.de to forum.lumix-transporte.de it is finally working. Thank you jacek.ciach for saying that it may be caused by the forum itself. I found that after googling some more.

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
Splixz
  • 15
  • 1
  • 6

2 Answers2

0

Have a look at the DirectoryIndex directive of Apache. Your forum probably does using something different than the default index.html.

See http://httpd.apache.org/docs/2.4/mod/mod_dir.html for more information.

Lambert
  • 12,495
  • 2
  • 26
  • 35
  • Yes. It isn't index.html, it is index.php. Now my forum.conf looks like that: ` ServerName forum.lumix-transporte.de ServerAdmin [email protected] DocumentRoot /var/www/forum Options Indexes FollowSymLinks MultiViews AllowOverride All DirectoryIndex index.php ` The problem is still there. – Splixz Jun 14 '15 at 18:08
  • And you know you have `php` installed and restarted Apache after the configuration changes? – Lambert Jun 14 '15 at 18:36
  • Sure i have installed php. I have reloaded apache after changing the .conf file. // Restarted apache now too, the problem still exists. – Splixz Jun 14 '15 at 18:50
0

1st solution

Check also the order in which your *.conf files are processed.

If a .conf for *.lumix-transporte.de is ,,run'' before forum.conf and has a sort of redirection directive, then the forum.conf will never be even processed.

So you can change the order (for example by changing the name of forum.conf to 000-forum.conf) or, what is better in my opinion, modify .conf for *.lumix-transporte.de in such a way, that it won't conflict with forum.conf (look at ServerName and ServerAlias for wildcards and check directives which may cause a redirect).

2nd solution

In default there's no ServerName, so when Apache processes default before forum.conf, then it sends to a client the website under /var/www.

Add ServerName lumix-transporte.de (in <VirtualHost>) to default and restart Apache.

3rd solution

It seems, that the forum itself causes the redirection. (Check response header of http://forum.lumix-transporte.de/ with i.e. http://web-sniffer.net/ and you'll see...).

jacek.ciach
  • 198
  • 8
  • I dont have a conf for lumix-transporte.de . I only have an A-Record for lumix-transporte.de so *.lumix-transporte.de. But the weird thing is that I tried that with phpmyadmin already and it worked properly. – Splixz Jun 14 '15 at 18:15
  • Could you explain what have you tried with phpMyAdmin? – jacek.ciach Jun 14 '15 at 18:20
  • Even there's not a `.conf` for `*.lumix-transporte.de`, your Apache has something that can be called ,,global'' or ,,main'' config file. – jacek.ciach Jun 14 '15 at 18:22
  • Where is this located? (As I said already I am pretty new) Is it the apache2.conf? – Splixz Jun 14 '15 at 18:25
  • I just tried if the vHost would work at all – Splixz Jun 14 '15 at 18:27
  • Where it is... it depends on your distro and the way you installed Apache. For example, if `forum.conf` is in `/etc/apache2/sites-enabled/`, then the ,,main config'' will be in `/etc/apache2/` or in its subdirectories (try looking for every `*.conf`) – jacek.ciach Jun 14 '15 at 18:32
  • I have a default file in /etc/apache2/sites-available – Splixz Jun 14 '15 at 18:40
  • Are there any other files in `sites-available`? Could you edit your post and paste the content of `default`? – jacek.ciach Jun 14 '15 at 18:42
  • Yes here is a default-ssl file. // I edited the main post. – Splixz Jun 14 '15 at 18:51
  • Did what you said, nothing changed. – Splixz Jun 14 '15 at 19:00
  • Check other files for redirect directives (`apache2.conf`, `conf.d/*`, ...). – jacek.ciach Jun 14 '15 at 19:08
  • Have checked everything, found nothing that could cause the redirect. – Splixz Jun 14 '15 at 19:13
  • I'm pretty sure, there is something causing the redirection. If there wasn't, a client wouldn't be redirected. ;) It is very difficult to figure out what this something is, when I'm unable to see your entire configuration. Tried `grep -R Redirect *` from `/etc/apache2`? When Apache does a redirect, it has to know the destination. And the destination is in a certain file. So try also `grep -R lumix-transporte.de *`. – jacek.ciach Jun 14 '15 at 19:27
  • ....or maybe the forum itself causes the redirect..... – jacek.ciach Jun 14 '15 at 19:29
  • I executed the 2 commands. Looks like there isnt a redirect caused by apache... (i posted it in the main post)# – Splixz Jun 14 '15 at 19:38