1

I have a website that is online at the moment. For this website, I have a subdomain staging.example.com. I am using GoDaddy for domain hosting. My server is on an EC2 Linux instance with AWS. I have tested the following links:

  • example.com works
  • www.example.com works
  • staging.example.com works
  • www.staging.example.com NOT WORKING

In GoDaddy DNS settings page, I have tried to add these values:

  • CNAME www.staging example.com
  • CNAME www staging.example.com
  • CNAME www.staging staging.example.com
  • A www.staging 3.1.11.xxx

But for these trials, I got the NGINX welcoming page when opening www.staging.example.com

enter image description here

I have also tried the internal forwarding feature of GODADDY (Sorry it is in Vietnamese, but basically it forwards https://www.staging.example.com to staging.example.com

enter image description here

For this case I only got page not available error.

Could somebody help me to see why staging.example.com is not working for me?

  • You need to configure your webserver. Do you run your own server (like on a VPS), or do you have a shared hosting account somewhere? Please add details about your hosting to your question so that we can help you. – Stephen Ostermiller Apr 11 at 10:16
  • @StephenOstermiller it is just GoDaddy normal web hosting. Is this what you are referring to? – Freelensia Apr 11 at 21:19
  • Have you added that subdomain to your hosting account? – Stephen Ostermiller Apr 12 at 16:44
  • @StephenOstermiller how do I do that? I know how to modify DNS values with GoDaddy. Is this what you are referring to? Could you tell me what I should do (like add a CName or A record, etc.) Thanks! – Freelensia Apr 12 at 19:03
  • 1
    No, you need to configure the webserver to handle requests for that domain. When you get the nginx error, that is the webserver not knowing about the domain and what content to show for it. Somebody should be able to tell you how to set up your Godaddy hosting. – Stephen Ostermiller Apr 12 at 20:31
1

You have to add that sub domain in your nginx virtual host in AWS EC2 to accept request from that sub domain Add new virtual host as "staging.example.com" under this directory /etc/nginx/sites-available/

server {
        listen 80;
        listen [::]:80;

        root /var/www/staging.example.com/html;
        index index.html index.htm index.nginx-debian.html;

        server_name staging.example.com www.staging.example.com;

        location / {
                try_files $uri $uri/ =404;
        }
}

Then enable new virtual host by using this command in terminal

ln -s /etc/nginx/sites-available/staging.example.com /etc/nginx/sites-enabled/

Restart nginx

systemctl restart nginx
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.