I Have two applications running on my server with domains
x.abc.com
admin.x.abc.com
x.abc.com is running on port 80
admin.x.abc.com is running on port 8080
I can able to access x.abc.com from browser, but when I try admin.x.abc.com, it is sending requests to x.abc.com only.
What is the proper way to configure two different web applications with different domain & port on single machine. Listed below my virtualhost files for x.abc.com & admin.x.abc.com respectively
<VirtualHost *:80>
ServerName www.x.abc.com
ServerAlias x.abc.com
RailsEnv test
DocumentRoot /home/cp/cp/public
<Directory /home/cp/cp/public/>
</Directory>
LogLevel warn
ErrorLog /home/cp/cp/log/error.log
CustomLog /home/cp/cp/access.log combined
RewriteCond %{HTTP_HOST} ^admin.x.abc.com
RewriteRule (.*) http://localhost:8080/$1 [R=301,L]
</VirtualHost>
<VirtualHost *:8080>
ServerName www.admin.x.abc.com
ServerAlias admin.x.abc.com
RailsEnv test
DocumentRoot /home/cp/cp_admin/public
<Directory /home/cp/cp_admin/public/>
</Directory>
LogLevel warn
ErrorLog /home/cp/cp_admin/log/error.log
CustomLog /home/cp/cp_admin/access.log combined
</VirtualHost>