antonyf Posted November 4, 2008 Share Posted November 4, 2008 Hi, I have a single IP and use VirtualHosts to host multiple domains. I want all domains pointed at my server and not on the VH configuration to navigate to the document root i.e. /opt/apache2/wwwroot I then want to point specific domains to their respective root folder i.e. /client/studioworld_se/public_html My problem is that when I point my browser to one of my VH domains it goes to the correct client folder but redirects the url to the default ServerName. I.e. www.studioworld.se show the correct site but the url is changed to web.adotapart.com. This is a sample of my configuration: httpd.confg ServerRoot "/opt/apache2" ServerName "web.adotapart.com" ServerAdmin antony@adotapart.com Listen 80 DocumentRoot "/opt/apache2/wwwroot" <Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Deny from all </Directory> <Directory "/opt/apache2/wwwroot"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> httpd-vhosts.conf NameVirtualHost *:80 <VirtualHost *:80> ServerName studioworld.se ServerAlias www.studioworld.se DocumentRoot /client/studio_world/public_html <Directory /client/studio_world/public_html> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost> Quote Link to comment https://forums.phpfreaks.com/topic/131340-apache-virtualhost-issue/ Share on other sites More sharing options...
trq Posted November 4, 2008 Share Posted November 4, 2008 If all your sites are defined within virtual hosts its safe to remove any ServerName and DocumentRoot directives from within your global configuration. Quote Link to comment https://forums.phpfreaks.com/topic/131340-apache-virtualhost-issue/#findComment-682001 Share on other sites More sharing options...
antonyf Posted November 4, 2008 Author Share Posted November 4, 2008 Okej - that might work. Can I still have one site take care of all domains not registered as a VH? Quote Link to comment https://forums.phpfreaks.com/topic/131340-apache-virtualhost-issue/#findComment-682007 Share on other sites More sharing options...
trq Posted November 4, 2008 Share Posted November 4, 2008 Okej - that might work. Can I still have one site take care of all domains not registered as a VH? Yes. Just put this catch all domain in the first defined virtual host. Quote Link to comment https://forums.phpfreaks.com/topic/131340-apache-virtualhost-issue/#findComment-682012 Share on other sites More sharing options...
antonyf Posted November 4, 2008 Author Share Posted November 4, 2008 I've removed ServerName and DocumentRoot but still the VirtualHost redirects to web.adotapart.com. UserDir is on in may case, might that affect this? Quote Link to comment https://forums.phpfreaks.com/topic/131340-apache-virtualhost-issue/#findComment-682018 Share on other sites More sharing options...
trq Posted November 4, 2008 Share Posted November 4, 2008 I've removed ServerName and DocumentRoot but still the VirtualHost redirects to web.adotapart.com. UserDir is on in may case, might that affect this? You did restart the server? Quote Link to comment https://forums.phpfreaks.com/topic/131340-apache-virtualhost-issue/#findComment-682020 Share on other sites More sharing options...
antonyf Posted November 4, 2008 Author Share Posted November 4, 2008 Yepp =) Quote Link to comment https://forums.phpfreaks.com/topic/131340-apache-virtualhost-issue/#findComment-682027 Share on other sites More sharing options...
antonyf Posted November 4, 2008 Author Share Posted November 4, 2008 I figured out some of the errors but I still don't get it working. Apparently when I navigate to http://www.studioworld.se it redirects to use the root http://web.adotapart.com and uses http://web.adotapart.com/~studioworld_se as root and I cant't figure out why? Thank you for any advice. httpd.conf Listen 80 LoadModule authn_file_module modules/mod_authn_file.so LoadModule authn_dbm_module modules/mod_authn_dbm.so LoadModule authn_anon_module modules/mod_authn_anon.so LoadModule authn_dbd_module modules/mod_authn_dbd.so LoadModule authn_default_module modules/mod_authn_default.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_groupfile_module modules/mod_authz_groupfile.so LoadModule authz_user_module modules/mod_authz_user.so LoadModule authz_dbm_module modules/mod_authz_dbm.so LoadModule authz_owner_module modules/mod_authz_owner.so LoadModule authz_default_module modules/mod_authz_default.so LoadModule auth_basic_module modules/mod_auth_basic.so LoadModule auth_digest_module modules/mod_auth_digest.so LoadModule cache_module modules/mod_cache.so LoadModule mem_cache_module modules/mod_mem_cache.so LoadModule dbd_module modules/mod_dbd.so LoadModule dumpio_module modules/mod_dumpio.so LoadModule ext_filter_module modules/mod_ext_filter.so LoadModule include_module modules/mod_include.so LoadModule filter_module modules/mod_filter.so LoadModule deflate_module modules/mod_deflate.so LoadModule ldap_module modules/mod_ldap.so LoadModule log_config_module modules/mod_log_config.so LoadModule log_forensic_module modules/mod_log_forensic.so LoadModule logio_module modules/mod_logio.so LoadModule env_module modules/mod_env.so LoadModule mime_magic_module modules/mod_mime_magic.so LoadModule cern_meta_module modules/mod_cern_meta.so LoadModule expires_module modules/mod_expires.so LoadModule headers_module modules/mod_headers.so LoadModule ident_module modules/mod_ident.so LoadModule usertrack_module modules/mod_usertrack.so LoadModule unique_id_module modules/mod_unique_id.so LoadModule setenvif_module modules/mod_setenvif.so LoadModule version_module modules/mod_version.so LoadModule ssl_module modules/mod_ssl.so LoadModule mime_module modules/mod_mime.so LoadModule dav_module modules/mod_dav.so LoadModule status_module modules/mod_status.so LoadModule autoindex_module modules/mod_autoindex.so LoadModule asis_module modules/mod_asis.so LoadModule info_module modules/mod_info.so LoadModule suexec_module modules/mod_suexec.so LoadModule cgi_module modules/mod_cgi.so LoadModule dav_fs_module modules/mod_dav_fs.so LoadModule vhost_alias_module modules/mod_vhost_alias.so LoadModule negotiation_module modules/mod_negotiation.so LoadModule dir_module modules/mod_dir.so LoadModule imagemap_module modules/mod_imagemap.so LoadModule actions_module modules/mod_actions.so LoadModule speling_module modules/mod_speling.so # LoadModule userdir_module modules/mod_userdir.so LoadModule alias_module modules/mod_alias.so LoadModule rewrite_module modules/mod_rewrite.so # LoadModule perl_module modules/mod_perl.so LoadModule php5_module modules/libphp5.so <IfModule !mpm_netware_module> User webservd Group webservd </IfModule> # 'Main' server configuration ServerRoot "/opt/coolstack/apache2" ServerAdmin antony@adotapart.com ServerName web.adotapart.com:80 DocumentRoot "/opt/coolstack/apache2/htdocs" <Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Deny from all </Directory> <Directory "/opt/coolstack/apache2/htdocs"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> <IfModule dir_module> DirectoryIndex index.html index.php </IfModule> <FilesMatch "^\.ht"> Order allow,deny Deny from all Satisfy All </FilesMatch> ErrorLog logs/error_log LogLevel warn <IfModule log_config_module> 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> 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/ "/opt/coolstack/apache2/cgi-bin/" </IfModule> <IfModule cgid_module> </IfModule> <Directory "/opt/coolstack/apache2/cgi-bin"> AllowOverride None Options None Order allow,deny Allow from all </Directory> DefaultType text/plain <IfModule mime_module> TypesConfig conf/mime.types AddType application/x-compress .Z AddType application/x-gzip .gz .tgz # PHP support PHPINIDir /opt/coolstack/php5/lib AddType application/x-httpd-php .php .phtml </IfModule> # # Customizable error responses come in three flavors: # 1) plain text 2) local redirects 3) external redirects # # Some examples: #ErrorDocument 500 "The server made a boo boo." #ErrorDocument 404 /missing.html #ErrorDocument 404 "/cgi-bin/missing_handler.pl" #ErrorDocument 402 http://www.example.com/subscription_info.html # # Server-pool management (MPM specific) Include conf/extra/httpd-mpm.conf # Multi-language error messages #Include conf/extra/httpd-multilang-errordoc.conf # Fancy directory listings #Include conf/extra/httpd-autoindex.conf # Language settings #Include conf/extra/httpd-languages.conf # User home directories # Include conf/extra/httpd-userdir.conf # Real-time info on requests and configuration #Include conf/extra/httpd-info.conf # Virtual hosts # Include conf/extra/httpd-vhosts.conf # Local access to the Apache HTTP Server Manual #Include conf/extra/httpd-manual.conf # Distributed authoring and versioning (WebDAV) #Include conf/extra/httpd-dav.conf # Various default settings #Include conf/extra/httpd-default.conf # Secure (SSL/TLS) connections # Include conf/extra/httpd-ssl.conf # # Note: The following must must be present to support # starting without SSL on platforms with no /dev/random equivalent # but a statically compiled-in mod_ssl. # <IfModule ssl_module> SSLRandomSeed startup builtin SSLRandomSeed connect builtin </IfModule> NameVirtualHost *:80 <VirtualHost *:80> ServerName studioworld.se ServerAlias www.studioworld.se FileEtag None DocumentRoot /export/client/studioworld_se/public_html <Directory "/export/client/studioworld_se/public_html"> Options FollowSymLinks AllowOverride All Order allow,deny Allow from all Header Set Cache-Control "max-age=0, no-store" </Directory> </VirtualHost> Quote Link to comment https://forums.phpfreaks.com/topic/131340-apache-virtualhost-issue/#findComment-682450 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.