Create host in ubuntu

To create host you need to have superuser permission. If you have then follow the below command line

sudo vi /etc/hosts
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/yoursite
sudo vi /etc/apache2/sites-available/yoursite

Then edit the code
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName www.yourwebsite.dev
DocumentRoot /var/www/yourwebsitefoldername
<Directory />
Options FollowSymLinks
AllowOverride None
<Directory /var/www/yourwebsitefoldername/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from ::1/128


Then make the site available and restart the apache server
sudo a2ensite yoursite
sudo service apache2 restart

No comments:

Post a Comment