Amazon Linux AMI Apache VirtualHost Port Redirect

I have an Amazon Linux AMI and am trying to redirect subdomain to different directories based on port number. I want default: 80 to be the production site and port: 8080 to be the dev site. Below is what I am trying to do in my httpd.conf file.

<VirtualHost *:80>
    ServerName subdomain.domain.com
    DocumentRoot /var/www/html/domain.com
    ErrorLog logs/domain.com-error_log
    CustomLog logs/domain.com-access_log common
</VirtualHost>

<VirtualHost *:8080>
    ServerName subdomain.domain.com
    DocumentRoot /var/www/html/test-domain.com
    ErrorLog logs/test-domain.com-error_log
    CustomLog logs/test-domain.com-access_log common
</VirtualHost>

      

So when I find subdomain.domain.com or subdomain.domain.com:80 it goes to the production site directory.

And when I hit subdomain.domain.com:8080 it ends up in the test site directory.

I have

Listen 80
Listen 8080

      

and

NameVirtualHost *:80
NameVirtualHost *:8080

      

included.

If I change the VirtualHost setting to IP with port to this:

<VirtualHost ###.###.###.###:8080>
    ServerName subdomain.domain.com
    DocumentRoot /var/www/html/test-domain.com
    ErrorLog logs/test-domain.com-error_log
    CustomLog logs/test-domain.com-access_log common
</VirtualHost>

      

I am redirecting me to the Linux testing page.

Am I missing something?

+3
linux amazon port virtualhost ami


source to share


No one has answered this question yet

Check out similar questions:

612
How to kill a process running on a specific port in Linux?
2
SVN (mod_dav) 403 Request FORBIDDEN OPTION
1
VirtualBox: how to access a virtual host in a virtual machine from the host?
1
Why does Wordpress unexpectedly connect to the MySQL database server when I upgrade the host from "localhost" to "mydomain.com"?
0
Redirect HTML "/" to WWW directory subfolder, VirtualHost DocumentRoot
0
% 1 in ErrorLog / CustomLog in Apache conf
0
Apache port forwarding
0
Xampp Virtualhost config not working
0
Xampp Virtualhost for Cross Domain Request



All Articles
Loading...
X
Show
Funny
Dev
Pics