Step 1 - Adding VirtualHost feature to the Web Server
The first step is that you need to initiate the xampp virtual host will be enabled. To do this, simply uncomment the following line on /opt/lampp/etc/httpd.conf file.
# sudo gedit /opt/lampp/etc/httpd.conf
Uncomment the following line by removing '#'
Remove the asah(#) Change this line, as i given below
#Include etc/extra/httpd-vhosts.conf -> Include etc/extra/httpd-vhosts.conf
Step 2 - Adding your website to virtualhost configuration file
Next, you need to edit /opt/lampp/etc/extra/httpd-vhosts.conf file to add your website.
# sudo gedit /opt/lampp/etc/extra/httpd-vhosts.conf
Add the following text to the bottom of the file.
<VirtualHost *:80>
ServerAdmin webmaster@example.com
DocumentRoot /opt/lampp/htdocs/example
ServerName www.example.com
ErrorLog logs/www.example.com-error_log
CustomLog logs/www.example.com-access_log common
</VirtualHost>
Step 3 - Registering your new website
Add your new website to /etc/hosts file
# sudo gedit /etc/hosts
Add the following lines
127.0.0.1 localhost
127.0.0.1 www.example.com
Step 4 - Restart XAMPP and test your new website
Lastly, restart your xampp server
# sudo opt/lampp/lampp restart
Go to http://www.example.com to view your new website.
The first step is that you need to initiate the xampp virtual host will be enabled. To do this, simply uncomment the following line on /opt/lampp/etc/httpd.conf file.
# sudo gedit /opt/lampp/etc/httpd.conf
Uncomment the following line by removing '#'
Remove the asah(#) Change this line, as i given below
#Include etc/extra/httpd-vhosts.conf -> Include etc/extra/httpd-vhosts.conf
Step 2 - Adding your website to virtualhost configuration file
Next, you need to edit /opt/lampp/etc/extra/httpd-vhosts.conf file to add your website.
# sudo gedit /opt/lampp/etc/extra/httpd-vhosts.conf
Add the following text to the bottom of the file.
<VirtualHost *:80>
ServerAdmin webmaster@example.com
DocumentRoot /opt/lampp/htdocs/example
ServerName www.example.com
ErrorLog logs/www.example.com-error_log
CustomLog logs/www.example.com-access_log common
</VirtualHost>
Step 3 - Registering your new website
Add your new website to /etc/hosts file
# sudo gedit /etc/hosts
Add the following lines
127.0.0.1 localhost
127.0.0.1 www.example.com
Step 4 - Restart XAMPP and test your new website
Lastly, restart your xampp server
# sudo opt/lampp/lampp restart
Go to http://www.example.com to view your new website.
No comments:
Post a Comment