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 “” 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 “” 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 and it’s single subdomain “” 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 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 “” at a2hosting which we use to test website changes. To test DigitalOcean droplet, I have changed the A records for the sub-domain “” and “” at a2hosting to point to the IP address ( 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 to droplet at Digital Ocean.

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

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

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

<VirtualHost *> DocumentRoot “/home/myadmin/” ServerName <Directory “/home/myadmin/”> allow from all Options None Require all granted </Directory> ServerAlias </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:


Pinging [] with 32 bytes of data: Request timed out. Request timed out. Request timed out.

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

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


Tracing route to [] over a maximum of 30 hops:

1 4 ms 2 ms 1 ms Tenda.Home [] 2 4 ms 8 ms 7 ms 3 3 ms 2 ms 2 ms [] 4 111 ms 114 ms 108 ms [] 5 141 ms 116 ms 98 ms 6 132 ms 158 ms 161 ms 7 145 ms 137 ms 103 ms 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


@logicallimit Awesome, glad you resolved the pinging issue. Under normal operations, you don’t really need to be able to ping an IP address, but it does help for testing purposes.

I would recommend editing your firewall rules to allow incoming TCP port 80 & port 8080 AND also allow incoming ICMP packets.

Regarding the file permissions, looks like you’re making progress. Try changing the permissions of the index.html file to 755 and see if loads for you then.

@dc250org . Thanks for your reply. The actual domain name is And subdomain is dev.

You are right in saying that firewall is blocking ping. I have removed firewall and I am able to ping now. For troubleshooting, I can disable firewall for some time, but in long run, I would need to configure it in best way. So thats one thing, that I would need help in.

Secondly, I checked the permissions on folders. It was hinted by technical support in reply to my ticket.

The structure of folder that I planned to keep is like

home/sysadmin/public_html home/sysadmin/ home/sysadmin/

And so on…

The sysadmin is username. I think, By default, when I created the user sysadmin, the permission on sysadmin folder was 700. And when I tried to access url in browser, it was giving error of 403 forbidden error on folder ‘/’ permission. I changed permissions on sysadmin folder to 755 and it started giving error on index.html. I have kept a simple index.html indide folder with permission 644.

If you access, you would find this very same error.

Thanks Devanshu

I’d be happy to help.

Looks like a networking issue. is “” your actual domain that you’re working with?

Also, the reason you may not get a response back by ping or traceroute could be your firewall blocking ICMP packets (you stated that your firewall is allowing TCP to port 80 and 8080, I assume it blocks other ports/protocols).

Everything you stated as far as configuring the domain looks good. But not knowing the actual domain makes it hard to dig deeper.

Let me know!

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

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.

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.