Skip to content

Instantly share code, notes, and snippets.

@smohadjer

smohadjer/virtual_host.md

Last active May 15, 2020
Embed
What would you like to do?
Updating virtual host
  1. Uncomment the following line in httpd.conf:

    # Virtual hosts
    #Include /private/etc/apache2/extra/httpd-vhosts.conf (mac)
    #Include conf/extra/httpd-vhosts.conf (windows)
    
  2. Add below snippet to httpd-vhosts.conf (use backslash in windows):

    <VirtualHost *:80>
    	ServerName localhost
    	DocumentRoot "/Users/sm/Documents"
    	<Directory "/Users/sm/Documents>
    		Options Indexes FollowSymLinks Includes ExecCGI
    		AllowOverride All
    		Require all granted
    		Allow from all
    	</Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
    ServerName html.launcher
    DocumentRoot "/Users/sm/Documents/ril/html.launcher/web"
    
    SetEnv DB_HOST         localhost
    SetEnv DB_USER         user
    SetEnv DB_PASS         pwd
    SetEnv DB_PORT         3306
    SetEnv DB_NAME         ril
    SetEnv SPACE_NAME      DEV
    
    <Directory "/Users/sm/Documents/ril/html.launcher/web">
    	DirectoryIndex index.php
    	AllowOverride All
    	Require all granted
    </Directory>
    </Virtualhost>
    
  3. Add the following to hosts file (located at /etc on Mac and at C:\Windows\System32\drivers\etc\hosts on windows)

    127.0.0.1   html.launcher
    
  4. Restart apache

    sudo apachectl restart (mac)
    httpd.exe (win)
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.