Question

How to configure only sub-domain in droplet.

I need help in configuring DNS to load test websites on subdomains. I get 403 forbidden error when I access the subdomain.

Let me brief about my requirement:

I have a number of domains for which websites are currently up and running at my other host a2hosting. Each of these domains have their email accounts. And for each domain, I have multiple subdomains. On some subdomains we have deployed operation support applications and some subdomains we use to test website changes before deploying it to production.

My expectation:

I want to do the migration to digital ocean droplet in phases with one domain at a time. At the moment we are looking to test the digitalocean droplet for performance of Magento 2.2.2 based website already running for one of the domains “www.abcdef.com” at a2hosting server.

As of now, I do not want to touch the main domain as it is in production. What I want is to point one of the subdomains “dev.abcdef.com” to this droplet so that we can test the performance of our production code in DigitalOcean.

Please note that, this droplet will be used not only for this domain abcdef.com and it’s single subdomain “dev.abcdef.com” but also to host a number of websites corresponding to my other domains and also for their respective subdomains in coming days. If the performance of our Magento 2.2.2 based website in this current testing goes well, then we may go for more droplets with higher configurations.

Note that, since I plan to use Varnish cache so I have set varnish at port 80 and the Apache server at 8080. Varnish and Apache, both are running on same droplet.

What I have done till now to achieve it:

  1. I have configured a firewall for my droplet to accept all TCP connection on port 80 and 8080. Please help me know, if this is right considering the fact that I want to use Varnish for this Magento 2.2.2 based website but I may not use varnish for every website. Some other websites that I will later host on this droplet may be based on other technologies and varnish may not be required for each of them.

  2. The domain abcdef.com is registered with bigrock and the corresponding website is currently hosted at a2hosting. So the Name Servers at bigrock currently points at a2hosting. I already have a sub-domain with name “dev.abcdef.com” at a2hosting which we use to test website changes. To test DigitalOcean droplet, I have changed the A records for the sub-domain “dev.abcdef.com” and “www.dev.abcdef.com” at a2hosting to point to the IP address (159.65.144.102) of droplet at DigitalOcean. I have not created any A records at domain registrar because the name servers configuration at domain registrar level already points to a2hosting IP address. So HTTP requests from user goes to my domain registrar, from there it goes to a2hosting and then from there I route request for subdomain dev.abcdef.com to droplet at Digital Ocean.

  3. I have configured domain and DNS at droplet as below:

Created a domain “abcdef.com” under Networking section. Following are my DNS records for this domain:

Type Hostname Value TTL (seconds)
A dev.abcdef.com directs to 159.65.144.102 3600
NS abcdef .com directs to ns1.digitalocean.com. 1800
NS abcdef .com directs to ns2.digitalocean.com. 1800
NS abcdef .com directs to ns3.digitalocean.com. 1800
  1. I am using Webmin to configure Virtual Hosts Following is my Virtual Host Settings in httpd.conf file.

<VirtualHost *> DocumentRoot “/home/myadmin/dev.abcdef.com” ServerName dev.abcdef.com <Directory “/home/myadmin/dev.abcdef.com”> allow from all Options None Require all granted </Directory> ServerAlias www.dev.abcdef.com </VirtualHost>

Problem Faced:

  1. I get 403 Forbidden error when I access the subdomain in url:
  2. The ping command to this subdomain results in timeout error as follows:

ping dev.abcdef.com

Pinging dev.abcdef.com [159.65.144.102] with 32 bytes of data: Request timed out. Request timed out. Request timed out.

Ping statistics for 159.65.144.102: Packets: Sent = 3, Received = 0, Lost = 3 (100% loss)

  1. The tracert command also gives timeout error as shown following:

tracert dev.abcdef.com

Tracing route to dev.abcdef.com [159.65.144.102] over a maximum of 30 hops:

1 4 ms 2 ms 1 ms Tenda.Home [192.168.1.1] 2 4 ms 8 ms 7 ms 10.0.0.1 3 3 ms 2 ms 2 ms pacenet.36.0.101.in-addr.arpa [101.0.36.1] 4 111 ms 114 ms 108 ms dsl-ncr-dynamic-105.124.16.125.airtelbroadband.in [125.16.124.105] 5 141 ms 116 ms 98 ms 182.79.203.229 6 132 ms 158 ms 161 ms 202.56.198.58 7 145 ms 137 ms 103 ms 138.197.249.23 8 * * * Request timed out.


I hope I could explain my problem to a satisfactory level. I have also raised a ticket with all these details for this issue but you can make out if I have to explain it again here on forum to get a solution, then how things would be there…

Can someone help me achieve my this simple requirement as explained above. I will be grateful to that helping hand!

Thanks Devanshu

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Ok. So the problem is solved. Here is how I resolved it.

Problem 1: Ping not working. Temporary Solution: Remove all firewalls applied on the droplet. But remember to put it back. When I removed firewall, I was able to ping. Try solution recommended by @AdrianStOnge .

Problem 2: 403 permission error on / Solution: Set 755 permission on folder with name of user. In my case it was “sysadmin”.

Problem 3: After resolving problem 2, I started getting permission error on /index.html You don’t have permission to access /index.html on this server. Solution: I let the permission of index.html remain at 644. Run the command “setsebool -P httpd_read_user_content on” as root user or a user with proper rights.

I got solution for Problem 3 from URL: Solution link

The moment I ran this command, my sub-domain was accessible!

@AdrianStOnge . I have set the permission of index.html to 0777 also and tried to load the page, but the same error still occurs.

The user group and username that currently shows in ownership details is sysadmin:sysadmin.

This is for sure some permission related issue. Has it got anything to do with the apache user permission with which server is running or something else. If yes, then what changes I would need to do to make it load index. Html.