Report this

What is the reason for this report?

How do I use subfolders of my server's IP address as their own "domains" without a FQDN

Posted on May 4, 2016

I am using a LAMP stack on Ubuntu 14x.

I want to use my server’s ip address/subfolder as a “root” domain (http://1.2.3.4/[client]), without using fully qualified domains (www.domain.com).

How do I set this up?

I read about using the apache userdir module, which seems like it would work, but I don’t know how to add users.

I also read about setting up virtual hosts, but it seems like that only applies if you are using fully qualified domain names(?)



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!

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.

You can use IP addresses in virtual hosts too, e.g.:

<VirtualHost *:80>
  ServerName 1.2.3.4
</VirtualHost>

For the userdir module:

sudo a2enmod userdir
sudo service apache2 restart

Apache uses the users on your droplet, so to add others:

sudo adduser newuser

… which creates the directory /home/newuser

sudo mkdir /home/newuser/public_html
sudo chmod 0755 /home/newuser/public_html

Apache will now serve files out of /home/newuser/public_html at the address http://1.2.3.4/~newuser.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.