LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-07-2012, 11:13 AM   #1
ocupado
LQ Newbie
 
Registered: Apr 2012
Posts: 9

Rep: Reputation: Disabled
Incorrect subdomains configuration under apache?


In my server i have to different domains running successfully.
Now I want to define a new subdomain under one of theses domains.

Running apache2ctl –S in order to see Virtual host defined, we get:

apache2: Could not reliably determine the server's fully qualified domain name, using 10.70.220.1 for ServerName
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:443 www.domain1.org (/etc/apache2/sites-enabled/000-default:59)
*:80 is a NameVirtualHost
default server www.domain1.org (/etc/apache2/sites-enabled/000-default:2)
port 80 namevhost www.domain1.org (/etc/apache2/sites-enabled/000-default:2)
port 80 namevhost subx.domain1.org (/etc/apache2/sites-enabled/000-default:48)
port 80 namevhost www.domain2.org (/etc/apache2/sites-enabled/000-default:54)
Syntax OK


It looks like virtual host are ok. When I try to browse to domain1.org or domain2.org everything is ok. The problem is when I try to brose to subdomain subx.domain1.org. This subdomain is not working properly.

I´m sure something is missing but I don’t know what.

Server version: Apache/2.2.3
Server built: Sep 8 2008 09:03:05

Thanks

Detailed Virtual Host Definitions
=================================

NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName www.domain1.org
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</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 /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
ServerSignature Off

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>


<VirtualHost *:80>
DocumentRoot /var/www/subx
ServerName subx.domain1.org
</VirtualHost>


<VirtualHost *:80>
DocumentRoot /var/www/domain2
ServerName www.domain2.org.ve
</VirtualHost>

Last edited by ocupado; 04-07-2012 at 11:19 AM. Reason: Adding Virtual Host definitions
 
Old 04-07-2012, 11:45 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
It looks like virtual host are ok. When I try to browse to domain1.org or domain2.org everything is ok. The problem is when I try to brose to subdomain subx.domain1.org. This subdomain is not working properly.
Please define what you mean by "is not working properly".
Apache config looks good, so it could be a dns issue, but without further details it's difficult to guess

Regards
 
Old 04-07-2012, 11:54 AM   #3
ocupado
LQ Newbie
 
Registered: Apr 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
Please define what you mean by "is not working properly".
Apache config looks good, so it could be a dns issue, but without further details it's difficult to guess

Regards
The error is in any browser: Page Not Found or IE cant show the page.
 
Old 04-07-2012, 12:08 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
The error is in any browser: Page Not Found or IE cant show the page.
So you get a 404 (not found) error. What's in apache error_log?
 
Old 04-07-2012, 12:29 PM   #5
ocupado
LQ Newbie
 
Registered: Apr 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
So you get a 404 (not found) error. What's in apache error_log?
Error logs contains the folowing:

[Sat Apr 07 10:10:15 2012] [error] [client 200.35.86.132] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/
[Sat Apr 07 10:11:50 2012] [error] [client 200.35.86.132] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/
[Sat Apr 07 10:12:27 2012] [error] [client 200.35.86.132] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/index.php/den...icios-publicos
[Sat Apr 07 10:12:55 2012] [error] [client 200.35.86.132] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/
[Sat Apr 07 10:13:04 2012] [error] [client 200.35.86.132] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/index.php/den...-defensoriales
[Sat Apr 07 10:13:52 2012] [error] [client 200.35.86.132] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/
[Sat Apr 07 10:14:10 2012] [error] [client 200.35.86.132] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/index.php/ins...rias-estadales
[Sat Apr 07 10:17:12 2012] [error] [client 190.204.233.200] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/templates/it_...te_css.css.php
[Sat Apr 07 10:25:53 2012] [error] [client 190.204.233.200] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/templates/it_...te_css.css.php
[Sat Apr 07 10:26:06 2012] [error] [client 190.204.233.200] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/templates/it_...te_css.css.php
[Sat Apr 07 10:26:37 2012] [error] [client 190.204.233.200] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/templates/it_...te_css.css.php
[Sat Apr 07 10:29:45 2012] [error] [client 74.125.158.85] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/index.php/com...iar-al-pueblo-
[Sat Apr 07 10:40:20 2012] [error] [client 186.92.241.69] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/
[Sat Apr 07 10:41:20 2012] [error] [client 186.92.241.69] File does not exist: /var/www/favicon.ico
[Sat Apr 07 10:42:46 2012] [error] [client 186.24.138.9] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/
[Sat Apr 07 10:43:37 2012] [error] [client 200.44.46.7] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/templates/it_...te_css.css.php
[Sat Apr 07 10:44:14 2012] [error] [client 200.44.46.7] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/templates/it_...te_css.css.php
[Sat Apr 07 10:44:39 2012] [error] [client 201.208.32.17] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/templates/it_...te_css.css.php
[Sat Apr 07 10:44:55 2012] [error] [client 186.92.241.69] File does not exist: /var/www/favicon.ico
[Sat Apr 07 10:45:06 2012] [error] [client 46.25.191.214] File does not exist: /var/www/lista.asp, referer: http://www.pearltrees.com/
[Sat Apr 07 10:45:23 2012] [alert] [client 199.21.99.67] /var/www/.htaccess: Option FollowSymLinks not allowed here
[Sat Apr 07 10:45:25 2012] [alert] [client 199.21.99.67] /var/www/.htaccess: Option FollowSymLinks not allowed here
[Sat Apr 07 10:45:35 2012] [error] [client 186.92.241.69] File does not exist: /var/www/favicon.ico
[Sat Apr 07 10:45:40 2012] [error] [client 186.70.80.24] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/index.php/den...icios-publicos
[Sat Apr 07 10:46:46 2012] [error] [client 186.92.241.69] File does not exist: /var/www/favicon.ico
[Sat Apr 07 10:46:56 2012] [error] [client 186.92.241.69] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/index.php/publicaciones
[Sat Apr 07 10:47:53 2012] [error] [client 186.92.150.155] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/
[Sat Apr 07 10:48:26 2012] [error] [client 186.91.91.45] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/
[Sat Apr 07 10:56:47 2012] [error] [client 186.92.241.69] File does not exist: /var/www/dp/templates/it_union/images/content_texture_t.jpg, referer: http://www.domain1.org/index.php/com...t/article/1457
 
Old 04-07-2012, 12:49 PM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Huh, I don't see any reference to subx.domain1.org in these logs. You should post the logs related to the not working subdomain.
Or add:
Code:
CustomLog /var/log/apache2/subx-access.log combined
ErrorLog /var/log/apache2/subx-error.log
inside the subx.domain1.org vhost container, so it creates its own logs, restart apache and test. And post here the subx-error.log.
 
Old 04-07-2012, 01:14 PM   #7
ocupado
LQ Newbie
 
Registered: Apr 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
Huh, I don't see any reference to subx.domain1.org in these logs. You should post the logs related to the not working subdomain.
Or add:
Code:
CustomLog /var/log/apache2/subx-access.log combined
ErrorLog /var/log/apache2/subx-error.log
inside the subx.domain1.org vhost container, so it creates its own logs, restart apache and test. And post here the subx-error.log.
I did the change suggested by you. Then restarted apache & try to browse to this subdomain. Result: the subx-error.log was created but is empty.

<VirtualHost *:80>
ServerName subx.domain.org
DocumentRoot /var/www/subx
ErrorLog /var/log/apache2/error_esc.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
ServerSignature Off
</VirtualHost>
 
Old 04-07-2012, 03:56 PM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
So you say that you visit http://subx.domain.org, you get a 404 error and you get nothing logged!
Are you sure you're visiting the right vhost? What gives
Code:
nslookup subx.domain.org
And what happens if you visit http://www.domain1.org/subx
 
Old 04-07-2012, 04:24 PM   #9
ocupado
LQ Newbie
 
Registered: Apr 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
So you say that you visit http://subx.domain.org, you get a 404 error and you get nothing logged!
Are you sure you're visiting the right vhost? What gives
Code:
nslookup subx.domain.org
And what happens if you visit http://www.domain1.org/subx
nslookup subx.domain.org

Server: 190.9.128.11
Address: 190.9.128.11#53

** server can't find subx.domain.org: NXDOMAIN


If I visit http://www.domain1.org/subx the browser redirect to http://www.domain1.org
 
Old 04-07-2012, 04:34 PM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
nslookup subx.domain.org

Server: 190.9.128.11
Address: 190.9.128.11#53

** server can't find subx.domain.org: NXDOMAIN
So your dns knows nothing about your new subdomain. You need to add an A record pointing to the IP address of your apache server


Quote:
If I visit http://www.domain1.org/subx the browser redirect to http://www.domain1.org
That shouldn't happen according to your apache config, but anyway if your new vhost works after the dns changing, I guess it will stop.
 
Old 04-07-2012, 04:44 PM   #11
ocupado
LQ Newbie
 
Registered: Apr 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
So your dns knows nothing about your new subdomain. You need to add an A record pointing to the IP address of your apache server



That shouldn't happen according to your apache config, but anyway if your new vhost works after the dns changing, I guess it will stop.
Do you know how can i add an A record pointing to the IP address?

Thanks
 
Old 04-07-2012, 04:56 PM   #12
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Do you know how can i add an A record pointing to the IP address?
Yeah I know. The admin of the nameserver that is authoritative for domain.org must add
Code:
subx.domain.org. IN  A x.x.x.x
(x.x.x.x is the IP of your apache), in the domain.org zone file, increase the serial number and reload the dns server.

Last edited by bathory; 04-22-2012 at 04:01 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache subdomains pokevitek Linux - Server 1 12-13-2009 08:37 PM
Apache and Subdomains Galaxy_Stranger Linux - Server 4 03-15-2008 02:20 AM
vhost configuration for CNAME wildcard subdomains leif_84 Linux - Server 1 01-08-2008 02:13 AM
APACHE and Subdomains basketkase999 Linux - Software 18 05-21-2005 10:38 PM
Apache and Subdomains, Help pzorn Linux - General 2 01-27-2004 07:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration