Page 1 of 1

Problem with virtual host

PostPosted: 31. December 2013 22:50
by zaalbarxx
Hello!
I have a big problem with setting my virtual hosts up. The problem is that one of virtual hosts is working good while the other is getting redirected to /xampp/. XAMPP version is the latest one(with PHP 5.5). My httpd-vhosts.conf looks like this:
Code: Select all
<Directory C:/vhosts>
Require all granted
</Directory>

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>

<Directory "c:/vhosts">
AllowOverride All
Order allow,deny
Allow from all
</Directory>

<VirtualHost *:80>
    DocumentRoot "C:/vhosts/roww-laravel/public/"
    ServerName row.dev
  <Directory "C:/vhosts/roww-laravel/">
    Options Indexes FollowSymLinks ExecCGI Includes
    AllowOverride all
    Require all granted
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/vhosts/test/public"
    ServerName test.dev
  <Directory "C:/vhosts/test/public">
    Options Indexes FollowSymLinks ExecCGI Includes
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/angular"
    ServerName angular.dev
  <Directory "C:/xampp/htdocs/angular">
    Options Indexes FollowSymLinks ExecCGI Includes
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>


Test.dev is working good, but row.dev is not working at all and somehow I get redirected to https://row.dev/xampp/ . Honestly I have no idea why is that so, because both of sites are running with Laravel 4 and both have almost the same configuration. The difference is that test.dev is running on Laravel 4.1 and row.dev on Laravel 4.0 but it should not make any difference. I tried to run my other sites build with Laravel 4.0 and they also does not seem to work. I am not sure if .htaccess is even processed because in row.dev there is index_l.php file which acts like gateway for Laravel and if I remove index.php from directory then I can see directory content when I go to row.dev and it should not happen considering this .htaccess:
Code: Select all
<IfModule mod_rewrite.c>
        <IfModule mod_negotiation.c>
            Options -MultiViews
    </IfModule>

    RewriteEngine On

        # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
<IfModule>


Any idea why I get redirected to XAMPP panel ? When running like row.dev/test I get 500 error. Any help would be appreciated.

Re: Problem with virtual host

PostPosted: 01. January 2014 03:49
by gsmith
Since this is Apache 2.4, there's no need for
NameVirtualHost *:80

Another thing that people (I certainly have) have problems with is mixing the old pre 2.4 style access with the new 2.4 style.
pre 2.4:
Order allow,deny
Allow from all

is the same as the new:
Require all granted

It is best to just use one or the other throughout the entire config! For C:/vhosts/roww-laravel/ you are using both.

Other thing I notice, there is
<Directory C:/vhosts>
Require all granted
</Directory>
and
<Directory "c:/vhosts">
AllowOverride All
Order allow,deny
Allow from all
</Directory>

I'd suggest combining these into one;
<Directory "c:/vhosts">
AllowOverride All
Require all granted
</Directory>

and then everywhere you have;
Order allow,deny
Allow from all
replace with;
Require all granted

You can then comment out the LoadModule for mod_access_compat and save a few scraps of RAM.

So what you might end up with is;

Code: Select all
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>

<Directory "c:/vhosts">
AllowOverride All
</Directory>

<VirtualHost *:80>
    DocumentRoot "C:/vhosts/roww-laravel/public/"
    ServerName row.dev
  <Directory "C:/vhosts/roww-laravel/">
    Options Indexes FollowSymLinks ExecCGI Includes
    Require all granted
  </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/vhosts/test/public"
    ServerName test.dev
  <Directory "C:/vhosts/test/public">
    Options Indexes FollowSymLinks ExecCGI Includes
    Require all granted
  </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/angular"
    ServerName angular.dev
  <Directory "C:/xampp/htdocs/angular">
    Options Indexes FollowSymLinks ExecCGI Includes
    Require all granted
  </Directory>
</VirtualHost>

Re: Problem with virtual host

PostPosted: 03. January 2014 21:00
by vanalbert
Thank you gsmith -- I've been looking for this solution all morning:

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/angular"
ServerName angular.dev
<Directory "C:/xampp/htdocs/angular">
Options Indexes FollowSymLinks ExecCGI Includes
Require all granted
</Directory>
</VirtualHost>

I'm not sure exactly what I was doing wrong before, but this worked for me.

Van

Re: Problem with virtual host

PostPosted: 03. January 2014 21:34
by vanalbert
But now I've lost my localhost -- everything points to the virtualhost at:

<VirtualHost *:80>
DocumentRoot "C:/CORA/test/httpdocs"
ServerName local.test.com
ErrorLog "C:/CORA/test/local.test.com-error.log"
CustomLog "C:/CORA/test/local.test.com-error.log" common
<Directory "C:/CORA/test/httpdocs">
DirectoryIndex index.php
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

Any help is appreciated -- I've been suffering with 1.8.3 for several hours and am to the point of reverting back to 1.7.7 which I've used for years now with no problems.

BTW note that this 2.4 configuration is required to get Drupal to see the database links, in case there are other Drupal users out there.

Re: Problem with virtual host

PostPosted: 03. January 2014 21:47
by vanalbert
I got my localhost back with:

<VirtualHost *:80>
DocumentRoot "C:/XAMPP/htdocs"
ServerName localhost
ErrorLog "C:/XAMPP/apache/error/apache-error.log"
CustomLog "C:/XAMPP/apache/error/apache-customerror.log" common
<Directory "C:/XAMPP/htdocs">
DirectoryIndex index.php
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

But I'm sure that's not where the error logs are supposed to go. Where do they really belong?

Thanks -- glad to have this finally up and running after lots and lots of hapless googling -- Van

Re: Problem with virtual host

PostPosted: 03. January 2014 21:58
by Altrea
Code: Select all
ErrorLog "logs/error.log"
CustomLog "logs/access.log" common


=> \xampp\apache\logs\

Re: Problem with virtual host

PostPosted: 04. January 2014 00:32
by vanalbert
Done-- thanks!
Van