single ip multiple website hosting with rhel6.x/centos6.x virtual hosting

It is often useful to host multiple website on single ip to save resources of server.
This can be done by virtual host in your RHEL 6.x or centos 6.x

go to apache configuration directory

# cd /etc/httpd/conf.d
create a new file  myhost.conf

# vi myhost.conf


paste following lines  and change entries as per yours



 NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/home/websites/harshenterprises.org/"
    ServerName harshenterprises.org
    ServerAlias www.harshenterprises.org
    ErrorLog "/var/log/httpd/harshenterprises/error_log"
    CustomLog "/var/log/httpd/harshenterprises/access_log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/home/websites/dsstech.co.in"
    ServerName dsstech.co.in
    ServerAlias www.dsstech.co.in
    ErrorLog "/var/log/httpd/dsstech/error_log"
    CustomLog "/var/log/httpd/dsstech/access_log" common
</VirtualHost>

Restart apache service

# service httpd restart



in above example there is log location and files mentioned
you need to mannualy create the respective directory and files
empty files  can be created by " touch command " 

Comments

Popular posts from this blog

Running web ssh client on port 443 /80 with nginx as reverse proxy

Running cockpit behind nginx reverse proxy with nginx ssl and cockpit non ssl

Setup VOD streaming server with nginx using RTMP on Ubuntu 18.04