subdomain for mobile site

Posted May 18, 2017 2.3k views

Running Ubuntu 16.04 LTS 32bit, server is Nginx

I’m looking at the networking tab for my droplet and i added the following:


TTL: 43200

I don’t want the mobile version to be the same as the desktop version. I have two seperate index.html files. How do i point the to load the mobile version? Thanks.

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.

Submit an Answer
1 answer


You need to setup two different virtual hosts in Nginx, in one of them the server_name must be and points to the directory where index.html for the desktop site is located use root directive for this.

And the other virtual host should have in its server_name and its root directive should point to the other directory where the other index.html is located.

Check this for more information about how to setup nginx virtual hosts.

Hope this helps you.

by Justin Ellingwood
When using the Nginx web server, server blocks (similar to the virtual hosts in Apache) can be used to encapsulate configuration details and host more than one domain off of a single server. In this guide, we'll discuss how to configure server blocks in Nginx on an Ubuntu 16.04 server.