Multiple VirtualHosts - Debian & Apache - HotUKDeals
We use cookie files to improve site functionality and personalisation. By continuing to use HotUKDeals, you accept our cookie and privacy policy.
Get the HotUKDeals app free at Google Play

Search Error

An error occurred when searching, please try again!

Login / Sign UpSubmit

Multiple VirtualHosts - Debian & Apache

£0.00 @
So I have a VM with Debian 7 installed, I have installed Apache and setup my virtual host file, as below _VirtualHost *:80_ (removed the <> tags as the site strips them off and replaced with _ … Read More
WesD84 Avatar
2y, 4m agoPosted 2 years, 4 months ago
So I have a VM with Debian 7 installed, I have installed Apache and setup my virtual host file, as below

_VirtualHost *:80_ (removed the <> tags as the site strips them off and replaced with _
ServerAdmin [email protected]
ServerName localhost

DocumentRoot /var/www/
ErrorLog /var/log/apache2/error.log
LogLevel warn
_/VirtualHost_

which works fine when I browse to http://localhost

However If I create another host file, lets call it 'test' and enable it via terminal with sudo a2ensite test

_VirtualHost *:80_ (removed the <> tags as the site strips them off and replaced with _
ServerAdmin [email protected]
ServerName localhost

DocumentRoot /var/www/test
ErrorLog /var/log/apache2/error.log
LogLevel warn
_/VirtualHost_

then browse to http://localhost/test I receive a blank page with the link http://localhost/test/?page=test

Basically I would like to have multi sites, ie http://localhost - points to smf http://localhost/test - points to lets say a wordpress site.

Am I missing something, as it doesn't display the 'test' page?

Thanks
WesD84 Avatar
2y, 4m agoPosted 2 years, 4 months ago
Options

All Responses

(2) Jump to unreadPost an answer
Responses/page:
#1
Both of those configs are point to the same name local name (ie localhost) you need to use two different hostnames. like localhost and localhost2.

If all you want is multiple mini site you can have just one Virtualhost definition and have different or just have multiple folders in the /var/www test/test2/test3 this will then allow

http://localhost/test
http://localhost/test2
http://localhost/test3

Chris.
#2
Hi Chris,

Thanks for the response.

Ok so now I have one default site vhost with the below

_VirtualHost *:80_
ServerAdmin [email protected]
ServerName site1.com

DocumentRoot /var/www/site1


Options FollowSymLinks
AllowOverride None




Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all


ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/


AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all



ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

_/VirtualHost_

_VirtualHost *:80_

DocumentRoot /var/www/forums
ServerName forums.site.com

_/VirtualHost_

which does work when I browse to localhost I receive site 1 when I browse to localhost/smf I receive site 2 (smf forum) however on site1(http://localhost), if I were to click a link ie login I receive the below

Not Found

The requested URL /login was not found on this server.
Apache/2.2.22 (Debian) Server at localhost Port 80

However site2, http://localhost/forums everything seems to work fine, is it because of the Allow Override settings and/or the .htaccess file ?

Thanks

Post an Answer

You don't need an account to leave a response. Just enter your email address. We'll keep it private.

...OR log in with your social account

...OR comment using your social account

Thanks for your comment! Keep it up!
We just need to have a quick look and it will be live soon.
The community is happy to hear your opinion! Keep contributing!