473,327 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

setup Apache for Subdomains

usafshah
104 100+
HI all,
i have a domain abc.info on a remote server and its files are hosted on let say 217.56.34.12, and a subdomain subdomain.abc.info hosted on let say 80.45.1.26 ("/docs/www/") and another subdomain2.abc.info is also hosted on 80.45.1.26 ("/docs/www/domain2")
I'm running apache, what settings should i do in apache when as i type subdomain.abc.info and it opens the contents in /docs/www and as i type subdomain2.abc.info it opens the contents of /docs/www/subdomain2/

I have tried virtual host as follow

Expand|Select|Wrap|Line Numbers
  1. NameVirtualHost *
  2.  
  3. <VirtualHost *:80>
  4. ServerName subdomain.abc.info
  5. DocumentRoot "/docs/www"
  6. </VirtualHost>
  7.  
  8. <VirtualHost *:80>
  9. ServerName subdomain2.abc.info
  10. DocumentRoot "/docs/www/subdomain2"
  11. </VirtualHost>
but the thing is when i type subdomain.abc.info and subdomain.abc.info both open the contents of /docs/www



Best Regards
Jan 18 '07 #1
12 23056
usafshah
104 100+
Apache is running on 80.45.1.26
Jan 18 '07 #2
Motoma
3,237 Expert 2GB
I believe, and don't hold me to this, that you need to specify the domain name in the <VirtualHost> tag as well:

Expand|Select|Wrap|Line Numbers
  1. NameVirtualHost *
  2.  
  3. <VirtualHost subdomain.abc.info:80>
  4. ServerName subdomain.abc.info
  5. DocumentRoot "/docs/www"
  6. </VirtualHost>
  7.  
  8. <VirtualHost subdomain2.abc.info:80>
  9. ServerName subdomain2.abc.info
  10. DocumentRoot "/docs/www/subdomain2"
  11. </VirtualHost>
  12.  
Jan 18 '07 #3
usafshah
104 100+
yeah checked with that as well, same thing again.

both subdomains pointing me to same content "/docs/www"
Jan 18 '07 #4
Motoma
3,237 Expert 2GB
You don't happen to be using mod_ssl? If so, you will need to change the NameVirtualHost directive to include a port number:
Expand|Select|Wrap|Line Numbers
  1. NameVirtualHost *:80
  2.  
Jan 19 '07 #5
usafshah
104 100+
mod_ssl settings are:

Expand|Select|Wrap|Line Numbers
  1. <IfModule mod_ssl.c>
  2.     Include conf/ssl.conf
  3. </IfModule>

and checked with NameVirtualHost *:80 as well, nothing happened :S
Jan 19 '07 #6
usafshah
104 100+
this is the log of apache


[Fri Jan 19 23:37:07 2007] [warn] VirtualHost subdomain.abc.info:80 overlaps with VirtualHost subdomain2.abc.info:80, the first has precedence, perhaps you need a NameVirtualHost directive
[Fri Jan 19 23:37:07 2007] [warn] NameVirtualHost *:80 has no VirtualHosts
Jan 19 '07 #7
usafshah
104 100+
any solution ?
Jan 23 '07 #8
Motoma
3,237 Expert 2GB
any solution ?
Sorry, I was away for the weekend.
What platform are you running this on?
What version of Apache are you using?
Would you object to posting your httpd.conf file here, either pasting it in, or putting a link for me to download and look over?
Jan 23 '07 #9
usafshah
104 100+
Platform: Windows Xp sp2
Wampserver installed , here is the link
Apache 2.0.59
PHP 5.2.0 + PECL
MySQL 5.0.27


Expand|Select|Wrap|Line Numbers
  1.  
  2. ServerRoot "c:/wamp/apache2"
  3.  
  4.  
  5.  
  6. PidFile logs/httpd.pid
  7.  
  8.  
  9. Timeout 300
  10.  
  11.  
  12. KeepAlive On
  13.  
  14.  
  15. MaxKeepAliveRequests 100
  16.  
  17.  
  18. KeepAliveTimeout 15
  19.  
  20.  
  21. <IfModule mpm_winnt.c>
  22. ThreadsPerChild 250
  23. MaxRequestsPerChild  0
  24. </IfModule>
  25.  
  26.  
  27. Listen 80
  28.  
  29.  
  30. LoadModule access_module modules/mod_access.so
  31. LoadModule actions_module modules/mod_actions.so
  32. LoadModule alias_module modules/mod_alias.so
  33. LoadModule asis_module modules/mod_asis.so
  34. LoadModule auth_module modules/mod_auth.so
  35. #LoadModule auth_anon_module modules/mod_auth_anon.so
  36. #LoadModule auth_dbm_module modules/mod_auth_dbm.so
  37. #LoadModule auth_digest_module modules/mod_auth_digest.so
  38. LoadModule autoindex_module modules/mod_autoindex.so
  39. #LoadModule cern_meta_module modules/mod_cern_meta.so
  40. LoadModule cgi_module modules/mod_cgi.so
  41. #LoadModule dav_module modules/mod_dav.so
  42. #LoadModule dav_fs_module modules/mod_dav_fs.so
  43. LoadModule dir_module modules/mod_dir.so
  44. LoadModule env_module modules/mod_env.so
  45. #LoadModule expires_module modules/mod_expires.so
  46. LoadModule file_cache_module modules/mod_file_cache.so
  47. LoadModule headers_module modules/mod_headers.so
  48. LoadModule imap_module modules/mod_imap.so
  49. LoadModule include_module modules/mod_include.so
  50. LoadModule info_module modules/mod_info.so
  51. LoadModule isapi_module modules/mod_isapi.so
  52. LoadModule log_config_module modules/mod_log_config.so
  53. LoadModule mime_module modules/mod_mime.so
  54. LoadModule mime_magic_module modules/mod_mime_magic.so
  55. #LoadModule proxy_module modules/mod_proxy.so
  56. #LoadModule proxy_connect_module modules/mod_proxy_connect.so
  57. #LoadModule proxy_http_module modules/mod_proxy_http.so
  58. #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
  59. LoadModule negotiation_module modules/mod_negotiation.so
  60. LoadModule rewrite_module modules/mod_rewrite.so
  61. LoadModule setenvif_module modules/mod_setenvif.so
  62. #LoadModule speling_module modules/mod_speling.so
  63. LoadModule status_module modules/mod_status.so
  64. LoadModule unique_id_module modules/mod_unique_id.so
  65. LoadModule userdir_module modules/mod_userdir.so
  66. LoadModule usertrack_module modules/mod_usertrack.so
  67. LoadModule vhost_alias_module modules/mod_vhost_alias.so
  68. LoadModule php5_module "c:/wamp/php/php5apache2.dll"
  69.  
  70. ServerAdmin webmaster@localhost
  71.  
  72.  
  73. ServerName localhost:80
  74.  
  75.  
  76. UseCanonicalName Off
  77.  
  78.  
  79. DocumentRoot "C:/wamp/www"
  80.  
  81.  
  82. <Directory />
  83.     Options FollowSymLinks
  84.     AllowOverride None
  85. </Directory>
  86.  
  87.  
  88. <Directory "C:/wamp/www">
  89.  
  90.  
  91.     Options Indexes FollowSymLinks
  92.  
  93.  
  94.     AllowOverride all
  95.  
  96.  
  97.     Order Deny,Allow
  98.     Allow from all
  99.     Allow from 127.0.0.1
  100.  
  101.  
  102. </Directory>
  103.  
  104.  
  105. UserDir "c:/wamp/Apache2/users/"
  106.  
  107.  
  108. DirectoryIndex index.php index.php3 index.html index.htm index.html.var
  109.  
  110.  
  111. AccessFileName .htaccess
  112.  
  113.  
  114. <FilesMatch "^\.ht">
  115.     Order allow,deny
  116.     Deny from all
  117. </FilesMatch>
  118.  
  119.  
  120. TypesConfig conf/mime.types
  121.  
  122.  
  123. DefaultType text/plain
  124.  
  125.  
  126. <IfModule mod_mime_magic.c>
  127.     MIMEMagicFile conf/magic
  128. </IfModule>
  129.  
  130.  
  131. HostnameLookups Off
  132.  
  133.  
  134. ErrorLog ../logs/apache_error.log
  135.  
  136.  
  137. LogLevel warn
  138.  
  139.  
  140. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
  141. LogFormat "%h %l %u %t \"%r\" %>s %b" common
  142. LogFormat "%{Referer}i -> %U" referer
  143. LogFormat "%{User-agent}i" agent
  144.  
  145.  
  146. CustomLog ../logs/access.log common
  147.  
  148. ServerTokens Full
  149.  
  150.  
  151. ServerSignature On
  152.  
  153.  
  154. Alias /icons/ "c:/wamp/Apache2/icons/" 
  155.  
  156. <Directory "c:/wamp/Apache2/icons">
  157.     Options Indexes MultiViews
  158.     AllowOverride None
  159.     Order allow,deny
  160.     Allow from all
  161. </Directory>
  162.  
  163.  
  164. Alias /manual/ "c:/wamp/Apache2/htdocs/manual/"
  165.  
  166. <Directory "c:/wamp/Apache2/htdocs/manual">
  167.     Options Indexes
  168.     AllowOverride None
  169.     Order allow,deny
  170.     Allow from all
  171.  
  172.     <Files *.html>
  173.         SetHandler type-map
  174.     </Files>
  175.  
  176.     SetEnvIf Request_URI ^/manual/(de|en|es|fr|ja|ko|ru)/ prefer-language=$1
  177.     RedirectMatch 301 ^/manual(?:/(de|en|es|fr|ja|ko|ru)){2,}(/.*)?$ /manual/$1$2
  178. </Directory>
  179.  
  180.  
  181.  ScriptAlias /cgi-bin/ "c:/wamp/Apache2/cgi-bin/"
  182.  
  183.  ScriptAliased
  184. <Directory "c:/wamp/apache2/cgi-bin">
  185.     AllowOverride None
  186.     Options None
  187.     Order allow,deny
  188.     Allow from all
  189. </Directory>
  190.  
  191.  
  192. IndexOptions FancyIndexing VersionSort
  193.  
  194.  
  195. AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
  196.  
  197. AddIconByType (TXT,/icons/text.gif) text/*
  198. AddIconByType (IMG,/icons/image2.gif) image/*
  199. AddIconByType (SND,/icons/sound2.gif) audio/*
  200. AddIconByType (VID,/icons/movie.gif) video/*
  201.  
  202. AddIcon /icons/binary.gif .bin .exe
  203. AddIcon /icons/binhex.gif .hqx
  204. AddIcon /icons/tar.gif .tar
  205. AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
  206. AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
  207. AddIcon /icons/a.gif .ps .ai .eps
  208. AddIcon /icons/layout.gif .html .shtml .htm .pdf
  209. AddIcon /icons/text.gif .txt
  210. AddIcon /icons/c.gif .c
  211. AddIcon /icons/p.gif .pl .py
  212. AddIcon /icons/f.gif .for
  213. AddIcon /icons/dvi.gif .dvi
  214. AddIcon /icons/uuencoded.gif .uu
  215. AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
  216. AddIcon /icons/tex.gif .tex
  217. AddIcon /icons/bomb.gif core
  218.  
  219. AddIcon /icons/back.gif ..
  220. AddIcon /icons/hand.right.gif README
  221. AddIcon /icons/folder.gif ^^DIRECTORY^^
  222. AddIcon /icons/blank.gif ^^BLANKICON^^
  223.  
  224.  
  225. DefaultIcon /icons/unknown.gif
  226.  
  227.  
  228. ReadmeName README.html
  229. HeaderName HEADER.html
  230.  
  231.  
  232. IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
  233.  
  234.  
  235. AddLanguage ca .ca
  236. AddLanguage cs .cz .cs
  237. AddLanguage da .dk
  238. AddLanguage de .de
  239. AddLanguage el .el
  240. AddLanguage en .en
  241. AddLanguage eo .eo
  242. AddLanguage es .es
  243. AddLanguage et .et
  244. AddLanguage fr .fr
  245. AddLanguage he .he
  246. AddLanguage hr .hr
  247. AddLanguage it .it
  248. AddLanguage ja .ja
  249. AddLanguage ko .ko
  250. AddLanguage ltz .ltz
  251. AddLanguage nl .nl
  252. AddLanguage nn .nn
  253. AddLanguage no .no
  254. AddLanguage pl .po
  255. AddLanguage pt .pt
  256. AddLanguage pt-BR .pt-br
  257. AddLanguage ru .ru
  258. AddLanguage sv .sv
  259. AddLanguage zh-CN .zh-cn
  260. AddLanguage zh-TW .zh-tw
  261.  
  262.  
  263. 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
  264.  
  265.  
  266. ForceLanguagePriority Prefer Fallback
  267.  
  268.  
  269. AddCharset ISO-8859-1  .iso8859-1 .latin1
  270. AddCharset ISO-8859-2  .iso8859-2 .latin2 .cen
  271. AddCharset ISO-8859-3  .iso8859-3 .latin3
  272. AddCharset ISO-8859-4  .iso8859-4 .latin4
  273. AddCharset ISO-8859-5  .iso8859-5 .latin5 .cyr .iso-ru
  274. AddCharset ISO-8859-6  .iso8859-6 .latin6 .arb
  275. AddCharset ISO-8859-7  .iso8859-7 .latin7 .grk
  276. AddCharset ISO-8859-8  .iso8859-8 .latin8 .heb
  277. AddCharset ISO-8859-9  .iso8859-9 .latin9 .trk
  278. AddCharset ISO-2022-JP .iso2022-jp .jis
  279. AddCharset ISO-2022-KR .iso2022-kr .kis
  280. AddCharset ISO-2022-CN .iso2022-cn .cis
  281. AddCharset Big5        .Big5       .big5
  282. # For russian, more than one charset is used (depends on client, mostly):
  283. AddCharset WINDOWS-1251 .cp-1251   .win-1251
  284. AddCharset CP866       .cp866
  285. AddCharset KOI8-r      .koi8-r .koi8-ru
  286. AddCharset KOI8-ru     .koi8-uk .ua
  287. AddCharset ISO-10646-UCS-2 .ucs2
  288. AddCharset ISO-10646-UCS-4 .ucs4
  289. AddCharset UTF-8       .utf8
  290.  
  291.  
  292. AddCharset GB2312      .gb2312 .gb 
  293. AddCharset utf-7       .utf7
  294. AddCharset utf-8       .utf8
  295. AddCharset big5        .big5 .b5
  296. AddCharset EUC-TW      .euc-tw
  297. AddCharset EUC-JP      .euc-jp
  298. AddCharset EUC-KR      .euc-kr
  299. AddCharset shift_jis   .sjis
  300.  
  301.  
  302. AddType application/x-compress .Z
  303. AddType application/x-gzip .gz .tgz
  304. AddType application/x-httpd-php .php
  305. AddType application/x-httpd-php .php3
  306.  
  307.  
  308.  
  309. AddHandler type-map var
  310.  
  311.  
  312. BrowserMatch "Mozilla/2" nokeepalive
  313. BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
  314. BrowserMatch "RealPlayer 4\.0" force-response-1.0
  315. BrowserMatch "Java/1\.0" force-response-1.0
  316. BrowserMatch "JDK/1\.0" force-response-1.0
  317.  
  318.  
  319. BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
  320. BrowserMatch "MS FrontPage" redirect-carefully
  321. BrowserMatch "^WebDrive" redirect-carefully
  322. BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
  323. BrowserMatch "^gnome-vfs" redirect-carefully
  324. BrowserMatch "^XML Spy" redirect-carefully
  325. BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
  326.  
  327.  
  328. <IfModule mod_ssl.c>
  329.     Include conf/ssl.conf
  330. </IfModule>
  331.  
  332.  
  333.  
  334. NameVirtualHost *:80
  335.  
  336.  
  337. <VirtualHost subdomain.abc.info:80>
  338.  
  339. ServerName subdomain.abc.info
  340. DocumentRoot "C:/wamp/www"
  341.  
  342. </VirtualHost>
  343.  
  344. <VirtualHost subdomain2.abc.info:80>
  345.  
  346. ServerName subdomain2.abc.info
  347. DocumentRoot "C:/wamp/www/webmail"
  348.  
  349. </VirtualHost>
  350.  
  351.  
  352.  
  353. Include "c:/wamp/apache2/conf/alias/phpmyadmin.conf"
  354. Include "c:/wamp/apache2/conf/alias/sqlitemanager.conf"
  355.  
Jan 23 '07 #10
Motoma
3,237 Expert 2GB
Sorry for the long delay.
I have WAMP running on my desktop at work for testing purposes, and here is the solution that worked for me.

You had a line that said simply
Expand|Select|Wrap|Line Numbers
  1. ScriptAliased
I had to remove this line for Apache to even start.

In your virtual host section, you have the following set up:
Expand|Select|Wrap|Line Numbers
  1. <VirtualHost subdomain.abc.info:80>
  2.   ServerName subdomain.abc.info
  3.   DocumentRoot "C:/wamp/www"
  4. </VirtualHost>
  5.  
  6. <VirtualHost subdomain2.abc.info:80>
  7.   ServerName subdomain2.abc.info
  8.   DocumentRoot "C:/wamp/www/webmail"
  9. </VirtualHost>
  10.  
Replace that with this:
Expand|Select|Wrap|Line Numbers
  1. <VirtualHost *:80>
  2.   ServerName subdomain.abc.info
  3.   DocumentRoot /wamp/www
  4. </VirtualHost>
  5.  
  6. <VirtualHost *:80>
  7.   ServerName subdomain2.abc.info
  8.   DocumentRoot /wamp/www/webmail
  9. </VirtualHost>
  10.  
And everything should run smoothly.
Jan 24 '07 #11
usafshah
104 100+
Yesssssssssssss !!! :D


worked !!!! thanks man you are genious :P
Jan 25 '07 #12
Motoma
3,237 Expert 2GB
Glad to help.
Jan 25 '07 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: steve | last post by:
Hi I am writing an application which ideally requires the creation of subdomains dynamically via asp. However I want all the subdomains to point to 1 asp file, which I wish to use to figure out...
3
by: craigkenisston | last post by:
In an application I'm developing I will be using subdomains in the main website to hold some sections of the sites. There will be many serverside generated links that will point to this...
4
by: radiax | last post by:
Is there a way to associate or bind a subdomain to a tcp sockets under .net framework (vb.net / c#). I know ip address can be used when using sockets, but the problem is the ip address is shared...
10
by: See_Red_Run | last post by:
Hi, I am trying to figure out how to get started with PHP/MySQL. Everything I've read so far says to start with PHP first. I was expecting something like Visual Basic Express or some other type...
6
by: jm | last post by:
I am setting up Apache 2.0, PHP5, and PostgreSQL 8.2 on Windows XP. I have setup everything correctly in the past but recently had to do a reformat and have to do the installs all over again. ...
1
by: Gowri | last post by:
Hello, I am new to Python and am trying to setup Apache to serve Python using mod_python. I'm using a Windows XP box. here is a list of steps i followed for the installation: 1. Installed...
1
by: maflatoun | last post by:
Hi all, I've been doing ASP.NET C# for 4 years now and that's around the same # of years I've been away from PHP. But now I'm looking at this PHP position that looks really interesting to me....
9
by: Josh | last post by:
I run a Joomla website and am familiar with php in some but not all aspects. Currently I am trying to find some solutions related to session handling. Am I correct in saying that "login" is kept...
3
by: Jonathan Wood | last post by:
Perhaps someone who understand Web hosting can offer some insight into this. I have several sites hosted at http://www.crystaltech.com. There were highly recommended and seem pretty good. But...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.