How to add domain in Raw Server
First, add the user on server.
useradd example
Then go to the home folder and search the user.
cd /home/
ls -ld example
Then go to the user by giving the below command.
cd example
Create the public_html folder under that user.
mkdir public_html
Provide proper ownership and permission to public_html folder.
chown example. public_html
chmod 750 public_html
Now, add manual entries of virtual host at the end of httpd.conf. Before that take the copy of httpd.conf
cd /etc/httpd/conf/
cp httpd.conf httpd.conf-bak
vi /etc/httpd.conf
ex
—————————-
<VirtualHost 31.193.133.175:80>
ServerAdmin [email protected]
DocumentRoot /home/example/public_html
ServerName example.com
ErrorLog logs/example.com-error_log
CustomLog logs/example.com-access_log common
</VirtualHost>
change the document root path, server name, error logs and custom logs
save the files and restart the apache. First, check the apache syntax is correct.
httpd -t
/etc/init.d/httpd restart
Then create the DNS entry of the domain
Go to named path
cd /var/named/
Copy the entry of another domain
cp example1.com.db example.com.db-bak
mv example.com.db-bak example.com.db
Open that file now.
vi example.com.db
Accept name server replace the domain name with your main domain name.
$TTL 14400
example.com. 86400 IN SOA ns1.nameserver.com. abcd.gmail.com. (
2010020703 ;Serial Number
86400 ;refresh
7200 ;retry
3600000 ;expire
86400 ;minimum
)
example.com. 86400 IN NS ns1.nameserver.com.
example.com. 86400 IN NS ns2.nameserver.com.
example.com. 14400 IN A 31.193.133.175
example.com. 14400 IN MX 0 example.com.
mail 14400 IN CNAME example.com.
www 14400 IN CNAME example.com.
ftp 14400 IN A 31.193.133.175
save and quit the file.
Open named.conf file and the entery of that domain, First create the backup file of named.conf
cd /etc/
cp named.con named.conf-bak
vi /etc/named.conf
Copy the entry of another domain and replace the other domain with your domain name.
zone “example.com” {
type master;
notify no;
file “example.com.db”;};
Once done then restart the named service.
/etc/init.d/named restart
Restart the ftp service to connect to the server via FTP now.