Jump to content

Recommended Posts

Hello all,

 

I'm having some trouble getting my vhosts to be recognized by Apache. I'm running 2.2 on a windows 2003 box and I've gone ahead and set the default server to my site, created a proper directory and virturalhost area inside of the config file, even tried to move it external and uncomment the line to include the external virtual host file.

 

The end results is always the same: I can view the default site, but none of the others. Trying to go to any of the other addresses drops me back to the default host. I am running it on port 81, and have the listento address set properly on all hosts, but I'm not making much progress.

 

I can post my config if it will help, but if anyone has any ideas off hand...really struggling with this and I'd like to find a solve.

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/118481-solved-help-with-vhosts/
Share on other sites

ServerRoot "D:/Apache"

Listen 81

ServerName site1.homeftp.org

ServerAdmin jd@myserver.com

DocumentRoot "E:/site1.com/html"

  # LoadModule foo_module modules/mod_foo.so
  LoadModule actions_module modules/mod_actions.so
  LoadModule alias_module modules/mod_alias.so
  LoadModule asis_module modules/mod_asis.so
  LoadModule auth_basic_module modules/mod_auth_basic.so
  # LoadModule auth_digest_module modules/mod_auth_digest.so
  # LoadModule authn_alias_module modules/mod_authn_alias.so
  # LoadModule authn_anon_module modules/mod_authn_anon.so
  # LoadModule authn_dbd_module modules/mod_authn_dbd.so
  # LoadModule authn_dbm_module modules/mod_authn_dbm.so
  LoadModule authn_default_module modules/mod_authn_default.so
  LoadModule authn_file_module modules/mod_authn_file.so
  # LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
  # LoadModule authz_dbm_module modules/mod_authz_dbm.so
  LoadModule authz_default_module modules/mod_authz_default.so
  LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
  LoadModule authz_host_module modules/mod_authz_host.so
  # LoadModule authz_owner_module modules/mod_authz_owner.so
  LoadModule authz_user_module modules/mod_authz_user.so
  LoadModule autoindex_module modules/mod_autoindex.so
  # LoadModule cache_module modules/mod_cache.so
  # LoadModule cern_meta_module modules/mod_cern_meta.so
  LoadModule cgi_module modules/mod_cgi.so
  # LoadModule charset_lite_module modules/mod_charset_lite.so
  # LoadModule dav_module modules/mod_dav.so
  # LoadModule dav_fs_module modules/mod_dav_fs.so
  # LoadModule dav_lock_module modules/mod_dav_lock.so
  # LoadModule dbd_module modules/mod_dbd.so
  # LoadModule deflate_module modules/mod_deflate.so
  LoadModule dir_module modules/mod_dir.so
  # LoadModule disk_cache_module modules/mod_disk_cache.so
  # LoadModule dumpio_module modules/mod_dumpio.so
  LoadModule env_module modules/mod_env.so
  # LoadModule expires_module modules/mod_expires.so
  # LoadModule ext_filter_module modules/mod_ext_filter.so
  # LoadModule file_cache_module modules/mod_file_cache.so
  # LoadModule filter_module modules/mod_filter.so
  # LoadModule headers_module modules/mod_headers.so
  # LoadModule ident_module modules/mod_ident.so
  # LoadModule imagemap_module modules/mod_imagemap.so
  LoadModule include_module modules/mod_include.so
  # LoadModule info_module modules/mod_info.so
  LoadModule isapi_module modules/mod_isapi.so
  # LoadModule ldap_module modules/mod_ldap.so
  # LoadModule logio_module modules/mod_logio.so
  LoadModule log_config_module modules/mod_log_config.so
  # LoadModule log_forensic_module modules/mod_log_forensic.so
  # LoadModule mem_cache_module modules/mod_mem_cache.so
  LoadModule mime_module modules/mod_mime.so
  # LoadModule mime_magic_module modules/mod_mime_magic.so
  LoadModule negotiation_module modules/mod_negotiation.so
  # LoadModule proxy_module modules/mod_proxy.so
  # LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
  # LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
  # LoadModule proxy_connect_module modules/mod_proxy_connect.so
  # LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
  # LoadModule proxy_http_module modules/mod_proxy_http.so
  # LoadModule rewrite_module modules/mod_rewrite.so
  LoadModule setenvif_module modules/mod_setenvif.so
  # LoadModule speling_module modules/mod_speling.so
  # LoadModule ssl_module modules/mod_ssl.so
  # LoadModule status_module modules/mod_status.so
  # LoadModule substitute_module modules/mod_substitute.so
  # LoadModule unique_id_module modules/mod_unique_id.so
  # LoadModule userdir_module modules/mod_userdir.so
  # LoadModule usertrack_module modules/mod_usertrack.so
  # LoadModule version_module modules/mod_version.so
  # LoadModule vhost_alias_module modules/mod_vhost_alias.so

<IfModule !mpm_netware_module>
  <IfModule !mpm_winnt_module>
    User daemon
    Group daemon
  </IfModule>
</IfModule>

# 
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
<IfModule dir_module>
  DirectoryIndex index.php
</IfModule>

# 
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
<FilesMatch "^\.ht">
  Order allow,deny
  Deny from all
  Satisfy All
</FilesMatch>

ErrorLog "logs/error.log"

LogLevel warn

<IfModule log_config_module>
  # 
  # The following directives define some format nicknames for use with
  # a CustomLog directive (see below).
  LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
  LogFormat "%h %l %u %t \"%r\" %>s %b" common

  <IfModule logio_module>
    # You need to enable mod_logio.c to use %I and %O
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
  </IfModule>

  CustomLog "logs/access.log" common
</IfModule>

<IfModule alias_module>
  ScriptAlias /cgi-bin/ "D:/Apache/cgi-bin/"
</IfModule>

DefaultType text/plain

<IfModule mime_module>
  TypesConfig "conf/mime.types"
  AddType application/x-compress .Z
  AddType application/x-gzip .gz .tgz
</IfModule>

<IfModule ssl_module>
  SSLRandomSeed startup builtin
  SSLRandomSeed connect builtin
</IfModule>


# BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
PHPIniDir "D:/PHP/"
LoadModule php5_module "D:/PHP/php5apache2_2.dll"

<Directory "/">
  Options FollowSymLinks
  Deny from all
  Order deny,allow
  AllowOverride None
  # END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
</Directory>

<Directory "E:/site2.homeftp.org">
  Allow from All
  Order Allow,Deny
</Directory>

<VirtualHost site2.homeftp.org:81>
  ServerName site2.homeftp.org
  DirectoryIndex index.php
  DocumentRoot "E:/site2.homeftp.org"
</VirtualHost>

 

Removed most of the comments for the sake of length, but the important stuff is there.

 

Thanks!

Looks to me like you need a NameVirtualHost tag.  http://httpd.apache.org/docs/2.2/mod/core.html#namevirtualhost

 

Example:

NameVirtualHost *
<VirtualHost *>
    ServerName name1.com
    DocumentRoot "/usr/name1/public_html"
</VirtualHost>

<VirtualHost *>
    ServerName name2.com
    DocumentRoot "/usr/name2/public_html"
</VirtualHost>

Looks to me like you need a NameVirtualHost tag.  http://httpd.apache.org/docs/2.2/mod/core.html#namevirtualhost

 

Example:

NameVirtualHost *
<VirtualHost *>
    ServerName name1.com
    DocumentRoot "/usr/name1/public_html"
</VirtualHost>

<VirtualHost *>
    ServerName name2.com
    DocumentRoot "/usr/name2/public_html"
</VirtualHost>

 

That was it. Thank you!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.