LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Incorrect subdomains configuration under apache? (https://www.linuxquestions.org/questions/linux-server-73/incorrect-subdomains-configuration-under-apache-938632/)

ocupado 04-07-2012 11:13 AM

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>

bathory 04-07-2012 11:45 AM

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

ocupado 04-07-2012 11:54 AM

Quote:

Originally Posted by bathory (Post 4647199)
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.

bathory 04-07-2012 12:08 PM

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?

ocupado 04-07-2012 12:29 PM

Quote:

Originally Posted by bathory (Post 4647215)
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

bathory 04-07-2012 12:49 PM

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.

ocupado 04-07-2012 01:14 PM

Quote:

Originally Posted by bathory (Post 4647240)
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>

bathory 04-07-2012 03:56 PM

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

ocupado 04-07-2012 04:24 PM

Quote:

Originally Posted by bathory (Post 4647333)
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

bathory 04-07-2012 04:34 PM

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.

ocupado 04-07-2012 04:44 PM

Quote:

Originally Posted by bathory (Post 4647355)
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

bathory 04-07-2012 04:56 PM

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.


All times are GMT -5. The time now is 01:44 AM.