简体   繁体   中英

Virtualhost subdomain not working on AWS EC2

I'm trying to configure a reverse proxy on an AWS EC2 instance using XAMPP.

My httpd-vhosts.conf works fine from localhost, but not from my EC2 server:

<VirtualHost *:80>
  ProxyPreserveHost On
  ProxyRequests Off
  ServerName ec2-foo.us-east-2.compute.amazonaws.com
  ServerAlias ec2-foo.us-east-2.compute.amazonaws.com
  DocumentRoot "/opt/lampp/htdocs/main"
</VirtualHost>
<VirtualHost *:80>
  ProxyPreserveHost On
  ProxyRequests Off
  ServerName bar.ec2-foo.us-east-2.compute.amazonaws.com
  ProxyPass / http://example.com
  ProxyPassReverse / http://example.com
</VirtualHost>

There is no error when I access bar.localhost , but there is when I access it from bar.ec2-foo.us-east-2.compute.amazonaws.com .

Is there a way to fix this? If not, is there a way to access example.com via ec2-foo.us-east-2.compute.amazonaws.com/bar ?

Today I found out that Amazon doesn't have wildcard enabled for their public DNS. However, this can be accomplished on my own domain.

https://forums.aws.amazon.com/thread.jspa?threadID=64352

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM