Created
May 30, 2019 08:49
-
-
Save kayode-adechinan/a3ad2ec826418283dff5fb8c6a0a3dfe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Allow the usage of custom virtual hosts. Open the httpd.conf | |
sudo gedit /opt/lampp/etc/httpd.conf | |
2. Uncomment the line bellow | |
# Virtual hosts | |
Include etc/extra/httpd-vhosts.conf | |
3. Create a custom domain in the hosts file of your system | |
sudo gedit /etc/hosts | |
127.0.0.1 localhost | |
127.0.0.5 myawesomeproject | |
..... | |
4. Create your first virtual host | |
sudo gedit /opt/lampp/etc/extra/httpd-vhosts.conf | |
<VirtualHost 127.0.0.5:80> | |
DocumentRoot "/opt/lampp/htdocs/my-first-project" | |
DirectoryIndex index.php | |
<Directory "/opt/lampp/htdocs/my-first-project"> | |
Options All | |
AllowOverride All | |
Require all granted | |
</Directory> | |
</VirtualHost> | |
5. Test your virtual host | |
To test it, in the folder /opt/lampp/htdocs/my-first-project, create a simple PHP file (index.php) | |
that will contain the following PHP code: | |
<?php | |
echo "Hello world!"; | |
?> | |
6. Restart | |
sudo /opt/lampp/lampp restart | |
7. Check it out! | |
http://myawesomeproject/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment