make alias to setup VirtualHosts using XAMPP on MacOSX (Simple way)

Simple & Quick

Add these following lines in ~/.bash_profile file

1)  alias goextra='cd /Applications/xampp/xamppfiles/etc/extra'
2). alias editvhost='sublime httpd-vhosts.conf'

and run " . ~/.bash_profile " .

and please run goextra and editvhost in your terminal respectively.

When you run editvhost httpd-vhosts.conf will be opened.

Add following lines to the file. You can also use the dummy lines in the file as reference.

#dummy.local
<VirtualHost *:80>
    ServerName dummy.local
    DocumentRoot "/Users/You/Your_Projects/dummyproject"
    <Directory "/Users/You/Your_Projects/dummyproject">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog "logs/dummy.local-error_log"
</VirtualHost>

3). alias edithost='sudo sublime /etc/hosts'

Add following line in #Virtual Hosts section of the hosts file.
# Virtual Hosts
127.0.0.1 dummy.local

Restart your Apache on xampp.

You are good to go. 

If you have any question or better way to do this or to share your ideas, please leave a comment or send me an email at lynnnayko@gmail.com or tweet me @lynnnayko

Thank you very much for your time.



Popular posts from this blog

npm refusing to install as a dependency of itself

How to call javascript functions from VB.NET and using WebBrowser Control