Create virtual host in local pc for you website in ubuntu
Create virtual host in local pc for you website in ubuntu
1) open you terminal with sudo su
2) cd /etc/apache2/sites-available/ paste this into your terminal .
3) sudo cp 000-default.conf example1.com.conf
4) go to folder /etc/apache2/sites-available/ and open file example1.com.conf into any editor you want
5) than paste below code
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/example1/
ServerName example1.dev
ServerAlias www.example1.dev
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
6) save the file asked for password enter your root password .
7) open your terminal and run sudo a2ensite example1.com.conf
8) sudo systemctl restart apache2
or
sudo service apache2 restart
9) open file /etc/hosts
enter this 2 line
192.168.1.30 example1.dev
192.168.1.30 www.example1.dev
#Note: 192.168.1.30 is my pc ip so you write your ip
1) open you terminal with sudo su
2) cd /etc/apache2/sites-available/ paste this into your terminal .
3) sudo cp 000-default.conf example1.com.conf
4) go to folder /etc/apache2/sites-available/ and open file example1.com.conf into any editor you want
5) than paste below code
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/example1/
ServerName example1.dev
ServerAlias www.example1.dev
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
6) save the file asked for password enter your root password .
7) open your terminal and run sudo a2ensite example1.com.conf
8) sudo systemctl restart apache2
or
sudo service apache2 restart
9) open file /etc/hosts
enter this 2 line
192.168.1.30 example1.dev
192.168.1.30 www.example1.dev
#Note: 192.168.1.30 is my pc ip so you write your ip
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment