Create a webroot directory in /var/www ..
Eg : /var/www/dh
Create a file in sites-available.  /etc/apache2/sites-available

  1. File contains
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName dhanesh.com
        ServerAlias  www.dhanesh.com
        DocumentRoot /var/www/dh
        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        <Directory /var/www/dh>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
        ErrorLog /var/log/apache2/error.log
       # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn
        CustomLog /var/log/apache2/access.log combined
</VirtualHost>
Change path and webroot from the above file
3. a2ensite [site]

a2ensite  is a script that enables the specified site (which contains a
       <VirtualHost> block) within the apache2 configuration.  It does this by
       creating  symlinks within /etc/apache2/sites-enabled.
4.Go to /etc/bind# and create file for the domain

$TTL    604800
@       IN      SOA     ns1.dhanesh.com. root.dhanesh.com. (
2006020201 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800); Negative Cache TTL

@       IN      NS      ns1
IN      A       176.32.70.207
IN      MX     1 ASPMX.L.GOOGLE.COM
IN      MX     5 ALT1.ASPMX.L.GOOGLE.COM
IN      MX     5 ALT2.ASPMX.L.GOOGLE.COM
IN      MX     10 ASPMX2.GOOGLEMAIL.COM
IN      MX     10 ASPMX3.GOOGLEMAIL.COM
www     IN      A       176.32.70.207
ns1     IN      A       176.32.70.207

5 Add zone in named.conf.local
/etc/bind# vi named.conf.local

zone “dhanesh.com” {
type master;
file “/etc/bind/dhanesh.com”;
};

6) restart bind9 service from /etc/init.d/bind9 restart
7) Restart apache.    apache2ctl restart
————————————————————————————————
Creating group and setting permission to a user.
dhanesh@ip-10-170-189-37:~$ sudo groupadd grpdhanesh
dhanesh@ip-10-170-189-37:~$ sudo usermod -a -G grpdhanesh dhanesh
dhanesh@ip-10-150-189-37:~$ sudo usermod -a -G grpdhanesh www-data
dhanesh@ip-10-150-189-37:~$ ls /var/www/dh/
dhanesh@ip-10-150-189-37:~$ sudo chgrp -R grpdhanesh /var/www/dh/
dhanesh@ip-10-150-189-37:~$ sudo chmod 775 -R /var/www/dh/

 

Categories: personal

Comments are closed.