1
votes

I'm trying to setup the Symfony 3 on my local server and the problem is I can't make my Virtual Hosts working.

vhosts file:

<VirtualHost *:80>
    ServerName localhost.dev.lt
    ServerAlias www.localhost.dev.lt

    DocumentRoot /www/testProject/web
    <Directory /www/testProject/web/>
        AllowOverride None
        Order Allow,Deny
        Allow from All
    </Directory>

    # uncomment the following lines if you install assets as symlinks
    # or run into problems when compiling LESS/Sass/CoffeScript assets
    #<Directory /www/testProject/>
    #     Options FollowSymlinks
    #</Directory>
</VirtualHost>

Also I added localhost.dev.lt into my hosts file. Mod Rewrite module is also enabled.

Could the DocumentRoot URL be written wrong? If I go to http://localhost.dev.lt/testProject/web/ Then it's working, the problem is that I get root directory then I go to http://localhost.dev.lt instead of /web.

2
You should define better what you mean by "it's working" or "it's not working". Exactly what do you see on the page in each of those cases? - Francesco Abeni
This is not the proper configuration. Either you should be directing your traffic to app(_dev).php, or use AllowOverride All - kero

2 Answers

1
votes

If navigating to http://localhost.dev.lt/testProject/web/ shows the home page of your Symfony project, make sure you don't have a different virtual host that sets localhost.dev.lt to /www/.

0
votes

Oh boy, the problem was that the vhosts.conf file was commented in main httpd.conf file, so the virtual hosts was not working at all. The line was "Include conf/extra/httpd-vhosts.conf".