Apache virtual host config vs global config problem

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Apache virtual host config vs global config problem
# 1  
Old 04-04-2013
Apache virtual host config vs global config problem

Hi folks,

I am trying to configure Apache webserver and also a virtual host inside this webserver.

For Global server config: /var/www/html/index.html
For virtual host config: /var/www/virtual/index.html

Both client10 & www10 are pointing to 192.168.122.10 IP address.

BUT, MY Global webserver is also now pointing to virtual host's home page. I am not sure how to prevent this. Can anyone help/advice to fix it?

thanks.

Code:
[root@client10 conf]# cat httpd.conf | egrep -v "^$|#|^BrowserMatch|^AddLanguage|^LoadModule|^AddIcon"
ServerTokens OS
ServerRoot "/etc/httpd"
PidFile run/httpd.pid
Timeout 60
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
</IfModule>
<IfModule worker.c>
StartServers 4
MaxClients 300
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
Listen 192.168.122.10:80
Include conf.d/*.conf
User apache
Group apache
ServerAdmin root@localhost
ServerName client10.example.com:80
UseCanonicalName Off
DocumentRoot "/var/www/html"
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/html/private >
Order deny,allow
Allow from 127.0.0.1
</Directory>
<IfModule mod_userdir.c>
UserDir disabled
</IfModule>
DirectoryIndex index.html index.html.var
AccessFileName .htaccess
<Files ~ "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</Files>
TypesConfig /etc/mime.types
DefaultType text/plain
<IfModule mod_mime_magic.c>
MIMEMagicFile conf/magic
</IfModule>
HostnameLookups Off
ErrorLog logs/error_log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog logs/access_log combined
ServerSignature On
Alias /icons/ "/var/www/icons/"
<Directory "/var/www/icons">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<IfModule mod_dav_fs.c>
DAVLockDB /var/lib/dav/lockdb
</IfModule>
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable Charset=UTF-8
DefaultIcon /icons/unknown.gif
ReadmeName README.html
HeaderName HEADER.html
LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW
ForceLanguagePriority Prefer Fallback
AddDefaultCharset UTF-8
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
AddHandler type-map var
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Alias /error/ "/var/www/error/"
<IfModule mod_negotiation.c>
<IfModule mod_include.c>
<Directory "/var/www/error">
AllowOverride None
Options IncludesNoExec
AddOutputFilter Includes html
AddHandler type-map var
Order allow,deny
Allow from all
LanguagePriority en es de fr
ForceLanguagePriority Prefer Fallback
</Directory>
</IfModule>
</IfModule>
NameVirtualHost 192.168.122.10
<VirtualHost 192.168.122.10>
ServerAdmin tony@www10.example.com
DocumentRoot /var/www/virtual
ServerName www10.example.com
ErrorLog logs/www10.example.com-error_log
CustomLog logs/www10.example.com-access_log common
</VirtualHost>

# 2  
Old 04-05-2013
Hi folks,

I still need help on this topic. could anyone please help explain why my MAIN/DEFAULT web server is also pointing to the "virtual host" server and how to fix it?

thanks.

[root@client10 ~]# nslookup www10
Server: 192.168.122.10
Address: 192.168.122.10#53

Non-authoritative answer:
Name:
www10.example.com
Address: 192.168.122.10


[root@client10 ~]# nslookup client10
Server: 192.168.122.10
Address: 192.168.122.10#53

Non-authoritative answer:
Name: client10.example.com
Address: 192.168.122.10



[root@client10 ~]# tail /etc/httpd/conf/httpd.conf
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/virtual
ServerName www10.example.com
ServerAdmin
tony@client10.example.com

</VirtualHost>


[root@client10 ~]# httpd -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
_default_:443 client10 (/etc/httpd/conf.d/ssl.conf:74)
*:80 is a NameVirtualHost
default server www10.example.com (/etc/httpd/conf/httpd.conf:1026)
port 80 namevhost www10.example.com (/etc/httpd/conf/httpd.conf:1026)
Syntax OK
[root@client10 ~]#

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Web Development

Config xcache apache

im use centos 6.8 & Apache/2.2.15 When I install xcache I get the following error PHP Warning: Module 'XCache' already loaded in Unknown on line 0 PHP Fatal error: XCache: create entries OOM in Unknown on line 0 PHP Fatal error: XCache: failed init variable cache in Unknown on line... (0 Replies)
Discussion started by: mnnn
0 Replies

2. Solaris

Network / global zones (Solaris 10 / 8) config recommendations

I have a few non-globa zones running in a 10.10.xx.xx network on a machine that is on a 192.168.xx.xx network. My goal is to allow each of the non-global zones to communicate to each other while not communicating on the 192.168.xx.xx network. I am using the current version of Solaris 10 in... (7 Replies)
Discussion started by: BradJM
7 Replies

3. UNIX for Dummies Questions & Answers

please help! routing/host config

I use a windows machine to connect VIA ftp to an old digital alphastation Unix box, the alpha station will only route the registered IP address of one computer to connect through tu1 card for FTP, the windows machine went down and i lost all the information on the drive so i built a new machine... (4 Replies)
Discussion started by: moticulus
4 Replies

4. Red Hat

Virtual Host Apache

Hi, I have set up the following virtual host but it cannot find the URL? Apache is running fine and I have disabled iptables. Within the document root I have the following file index.html displaying a sample text message. Any ideas what my problem might be? httpd.conf: ... (2 Replies)
Discussion started by: Duffs22
2 Replies

5. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated. script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made. OS :Susi linux ver 10.3. ... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

6. Shell Programming and Scripting

parsing config file to create new config files

Hi, I want to use a config file as the base file and parse over the values of country and city parameters in the config file and generate separate config files as explained below. I will be using the config file as mentioned below: (config.txt) country:a,b city:1,2 type:b1... (1 Reply)
Discussion started by: clazzic
1 Replies

7. Solaris

Apache config issue

I want to build a little website on a Sun Blade 100 running Solaris 10. I just went out to apache.org and downloaded Unix Source: httpd-2.2.8.tar.gz After unpacking the tarball, I CD'd into the subdirectory and ran the configure utility. Of course, it crapped out. I see that it is... (17 Replies)
Discussion started by: BrewDudeBob
17 Replies

8. UNIX for Dummies Questions & Answers

Apache Config

I need help doing two things in my Apache Config.... 1) Creating a Referer log where only domains other than my own (or a list I specify) are logged ...and... 2) I want to replace images loaded from my site, on other sites, it a standard RED "stolen" image. I currently have code in place... (2 Replies)
Discussion started by: l008com
2 Replies

9. UNIX for Dummies Questions & Answers

Apache virtual host

Would this be the correct entry for Apache to answer on the IP 129.250.242.126 if the servers IP is 129.250.242.125? Are any other changes necessary to get Apache to answer this IP for web traffic? < VirtualHost 129.250.242.126> ServerName www.my_domain.com ServerAdmin admin@my_domain.com... (4 Replies)
Discussion started by: 98_1LE
4 Replies

10. UNIX for Dummies Questions & Answers

Apache Config Files

Currently our Apache log files are huge, I want to put say a month's time limit on this, then when it hits the end of the month I would like it to start over writing. Does anyone know where the config file is for this and what its called? I also want to do exactly the same on wtmp config (who... (1 Reply)
Discussion started by: Webwitch
1 Replies
Login or Register to Ask a Question