How to setup a virtual host in Ubuntu?

Posted by Rade on Server Fault See other posts from Server Fault or by Rade
Published on 2013-06-29T14:53:47Z Indexed on 2013/07/01 4:22 UTC
Read the original article Hit count: 542

Filed under:
|
|

I have an app that's accessible via 1.2.3.4/myapp. The app is installed in /var/www/myapp. I've set up a subdomain(apps.mydomain.com) that points to 1.2.3.4. I want the server to point to var/www/myapp if I type apps.mydomain.com/myapp, how do I do that? I have experience creating virtual hosts(lots of them) locally but I'm lost because it's now in production and it's a little different. Here's my virtual host config:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName apps.mydomain.com/myapp

        DocumentRoot /var/www/myapp/public
        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride All
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        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>

Any idea why I still see the files instead of pointing me to the document root?

Just in case someone might ask, the app is based on Laravel 4 framework. It's really bad right now because anyone can access the files from the browser.

© Server Fault or respective owner

Related posts about apache2

Related posts about ubuntu