Is this the right way for this? Site building with no domain

OK, so am still fairly new to the VPS game, and have a lot of bad "ideas" since I've been on the shared hosting stuff for years. I currently have one domain on my linode IP and that is fine and dandy.

I started this VPS to see if it would be better for a friend's site that is on a shared server right now.

I figured out that http://MyIPAddy/ will load whatever is in the /var/www/ directory, so I planned on just making a sub-directory of /var/www/domain.to.test/

Is this the best way to test web sites before adding it to my virtual hosting and pointing the DNS for it? I planned on downloading all the current files and exporting the databases, and then uploading them/importing them to the above directory, but not sure if there is a better way (or safer way, if it applies) of doing this.

5 Replies

You probably need a better understanding of the way that various "sites" are accessed. You are essentially correct in what you said, but I suspect you are still a bit lost.

Assuming you are running Apache (which seems safe), when you type the URL:

http:///

Apache will return the index page for the default server. This will be pointed at whatever directory you have configured Apache to use. If you use the URL:

http:/// Apache will look in the filesystem for a subdirectory and return the index page for that directory. The exact identity of that index page (e.g.: index.html, index.php, binky.love) is also a configuration option.

This much you seem to understand properly, at least in practice.

The next idea, which you haven't yet gotten to, is virtual servers. A virtual server can be reached by either a unique name or a unique IP address. In your case, the servers will be names which all resolve to the same IP address. So, there is NO essential difference, EXCEPT that instead of requiring a , the hostname will provide a way to address the correct directory. It can even be in the same location, though that's probably not ideal.

Given all this, here is my suggestion: Place the various sites in a hierarchy that isn't a child of your default site. I use:

/usr/local/www/sites/ Then, use a symlink from your default site (or better, something like http://beta.yourdomain.com/ url="">>) You'll need to be sure to have the follow symlinks option on. When the site goes live, you'll simply need to delete the add the virtual server. You could delete the symlink at that point, if you want–but it wont matter, really.

Hope this addresses your concerns.

Correct, Apache on Ubuntu 10.4. The default location is in /var/www/

I should mention I already have a domain hosted, so going to http:// pulled that sites root folder in /srv/www//public_html/

Now, for the "temp-site", I have it in /var/www/. Going to http:/// currently displays the default directory, which as mentioned, is in /var/www/.

If I understand correctly, I can place the "temp-site" site in any other folder (will probably use the usr folder), and I understand what symlink does, but confused on one other area…

So, lets say I place the temp site, using your example, in /usr/local/www/sites/, and I want to access the site at http:///temp-site/ …. would I need to also create the folder /var/www/temp-site, and then symlink that folder to the one under the usr folder?

None of this will be a problem for me once I am ready to point the domain to my new VPS here, just don't want to do it yet of course because it is a live site hosted elsewhere.

Given the default hierarchy, here's my advice.

Create a directory /srv/www/ Create a symlink to that directory in /srv/www/

When you are ready, create a virtual server pointed at /srv/www/ for the server name Delete the symlink

I think your last reply in is confusion on my part of my explanation, however, I was able to get it to work. Made a folder /usr/local/www/sites/loj/, then I did

ln -s /usr/lcoal/www/sites/loj/* /var/www/loj/

I placed an index.html file into the folder /usr/local/www/sites/loj/ and now it seems to work: http://74.207.231.246/loj/

Anything I need to worry about with permissions? Also, should I scrub my actual folder info and IP info from this post?

> Anything I need to worry about with permissions?

Basic security-wise, the goal always seems to just be "turn off write everywhere you can", making sure the web server can't access anywhere it shouldn't is the key of course. Users not gaining access to each other's directories is another nice bonus, one that's a little scarily often missed by smaller hosts.

Certain apps using PHP and such will need write access to certain files for logs or cache or temporary space, things like that, but they'll usually point those out for you in their install docs pretty clearly.

If you want to give the users FTP access you're going to need to make sure they own their directories properly and things are appropriately set up so that uploaded files go into their ownership, setgid and setuid for group and user permissions at least.

I always used to forget this step, you want 'setuid'/'setgid' on the directory so that files added inherit these attributes. ( chmod 6755 and umask 0022 are pretty typical ways I think )

> Also, should I scrub my actual folder info and IP info from this post?

Couldn't hurt, right? Should keep you safe, at least until those crazy spies hear about Google cache or the internet archive! :shock:

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct