简体   繁体   中英

Create sub-domain on public url or IP for AWS instance

I have hosted my wordpress multisite on my amazon instance ec2-**-**-***-*.us-west-2.compute.amazonaws.com and the main site is showing on my IP **.**.***.* or public url , the sub-sites I wanted to show in sub domain so I have created the hosted on ec2 instance like

ec2-**-**-***-*.us-west-2.compute.amazonaws.com
india.ec2-**-**-***-*.us-west-2.compute.amazonaws.com
saudi.ec2-**-**-***-*.us-west-2.compute.amazonaws.com
canada.ec2-**-**-***-*.us-west-2.compute.amazonaws.com

or on IP like below

**.**.***.*
india.**.**.***.*
saudi.**.**.***.*
canada.**.**.***.*

So how can I use sub-domains on IP or public-url, I have added sub-domains to my hosts file and also added the virtual hosts for the same.

Note: I can add DNS to the domain hosting and host like domain.com, india.domain.com,saudi.domain.com,canada.domain.com but I wanted to use on IP or public URL of AWS instance.

hosts files:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost6 localhost6.localdomain6
127.0.0.1  **.**.**.* india.**.**.**.* saudi.**.**.**.* canada.**.**.**.*
127.0.0.1 ec2-**-**-***-*.us-west-2.compute.amazonaws.com india.ec2-**-**-***-*.us-west-2.compute.amazonaws.com canada.ec2-**-**-***-*.us-west-2.compute.amazonaws.com saudi.ec2-**-**-***-*.us-west-2.compute.amazonaws.com

Virtual host added for all regional sites

<VirtualHost *:80>
  ServerName india.ec2-**-**-***-*.us-west-2.compute.amazonaws.com
  ServerAlias india.ec2-**-**-***-*.us-west-2.compute.amazonaws.com
  DocumentRoot "/var/www/html"
  <Directory "/var/www/html">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
  </Directory>
</VirtualHost>

similarly added the virtual host for other sites canada and saudi and apart from this DocumentRoot "/var/www/html" will be same for all the site as I am making wordpress multisite.

Unfortunately you cannot do that. You can't modify the DNS of the domain amazonaws.com . This is the AWS domain for all AWS services, and it does not allow for any customer DNS records.

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