I'm trying to add a virtual host for my project

Discussion in 'Apache' started by jiros1, Feb 25, 2017.

  1. #1
    I'm developing with Symfony and I ran into an issue.

    My issue
    I want my files from this path:
    D:/media/sandbox/sf-boardgame/web/app_dev.php/

    To be accessed by this:
    sf.boardgame

    sandbox is my DocumentRoot.
    sf-boardgame is the name of my project


    What did I do?

    I have added in my hosts file:
    127.0.0.1 sf.boardgame

    In my vhosts file (httpd-vhosts.conf) I added:

    <VirtualHost *:80>
    DocumentRoot "D:/media/sandbox"
    ServerName sf.boardgame
    </VirtualHost>

    <VirtualHost *:8080>
    ServerName sf.boardgame
    DocumentRoot "D:/media/sandbox/sf-boardgame/web"
    DirectoryIndex app_dev.php
    <Directory "D:/media/sandbox/sf-boardgame/web>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ /app_dev.php [QSA,L]
    </IfModule>
    </Directory>
    </VirtualHost>
     
    jiros1, Feb 25, 2017 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    You have two different virtual hosts, with different port-mappings - why do you have that?
     
    PoPSiCLe, Feb 25, 2017 IP
  3. jiros1

    jiros1 Greenhorn

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #3
    I guess I was trying something out and forgot to remove the first one.
    I now have this code:

    <VirtualHost *:8080>
    ServerName sf.boardgame
    DocumentRoot "D:/media/sandbox/sf-boardgame/web"
    DirectoryIndex app_dev.php
    <Directory "D:/media/sandbox/sf-boardgame/web>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ /app_dev.php [QSA,L]
    </IfModule>
    </Directory>
    </VirtualHost>

    Hmm still not working, what could it be?
     
    jiros1, Mar 2, 2017 IP
  4. Andrew Shaw

    Andrew Shaw Member

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #4
    What error message is being returned?
    What does your /var/log/http/error_log say?
     
    Andrew Shaw, Mar 13, 2017 IP