How do you make a site private? - web

I'm just fooling around, learning the ins and outs of web development and I'd like to make my domain private until I'm ready to display it.
What's the best way to do this?
BTW, I have an Apache server on Debian.

use an .htaccess file to create a user/pass prompt (be warned that this can be bruteforced but it'll keep the general public out)
here's a good article on how to go about implementing this: http://www.freewebmasterhelp.com/tutorials/htaccess/3

You can do one of two things that I can think of:
Put it on a internal network that has no public access.
Require a password to see the the site and don't give it to anyone.

Other alternatives:
Set up a firewall rule to only allow your IP address(es) access to the site.
Use a subdomain that you don't tell anybody about (this is similar to the password and hidden directory options).

Quick and easy way would be to tell your computer's firewall to block port 80 (the port webservers use).
Also, depending on your webserver, you could configure it to only serve on localhost.
In Apache, for example, I believe you can edit the httpd.conf file and add Listen 127.0.0.1:80.

Put it in a hidden directory and have the toplevel site be an empty page. Unless someone knows or guesses the directory name, no one will see your actual site.

Related

Put a subfolder onto a different server with CNAME

Here's the situation. Website.com is an ASP site which needs a blog that is to be Wordpress. So the website.com/blog needs to be hosted onto a php-friendly server. The company hosting the ASP site doesn't want to have anything to do with Wordpress so we have to use some of the shared hosting providers.
How do I have the Blog section placed onto an entirely different server? I've heard this is done with CNAME, but I've never used it. Most of the research I've done revolves around subdomains, but I need a subfolder mapping, and there's not much to read about putting subfolders onto different servers with a different IP and everything.
Thanks.
There are a few different options:
you can bring the traffic to your own server and then redirect to
the correct location
you can bring the traffic to your own server and then proxy it to the correct location
you can direct the traffic to the correct location either via full page or an IFRAME type mechanism
Each option has some benefits and drawbacks depending your devs knowledge level and your infrastructure. Regarding subdomains, you could use a combination approach where you, for example, use subdomain.yourdomain.com to point to a server instance (can be the same server or a totally different one) that maps the subdomain.yourdomain.com name to a specific path, usually via Host header.
A CNAME is a function in DNS that says "Whatever thing you wanted to find for this name, use the same thing for that other name instead". When you're working with web stuff the "thing" in there is nearly always an IP address.
That is, what a CNAME can do for you is to say that when a user's web browser tries to look up the IP address for website.com, it will use the IP address for someotherwebsite.com. Note the total absence of anything web-related, like subfolders, in this. CNAMEs work on whole domain names, nothing else. Since you want to serve only a part of the stuff at a particular name from another server, CNAME cannot help you. CNAME is the wrong tool for you problem. Do not taunt happy fun CNAME.
In order to serve website.com/blog from another server than website.com, you pretty much have to do some sort of reverse proxying (where the ASP site's server relays requests between the user and the Wordpress server). It's probably easier and more robust to give the Wordpress site its own name (blog.website.com or something), and redirect to that from website.com/blog, but only you can know if that's politically possible in your case.

Direct a URL directly to a GlassFish application in a virtual server

We have a domain name with DNS management facility. We also have a web application developed in a GlassFish server hosted in a virtual server with a path is
http://198.98.103.233:8080/pemis/
I want to direct to the home page of that application when some one type the domain name. After navigating through the pages, we must be able to see
http://www.pemis.lk/faces/public.xhtml
in the browser rather than
http://198.98.103.233:8080/pemis/faces/public.xhtml
How can we configure that.
Thanks in advance.
You need to install your application as the root application in Glassfish, as explained here. But it's not hard:
asadmin deploy --contextroot "/" your-webapp.war
or set the context-root property in the sun-web.xml or glassfish-web.xml depending on the version of Glassfish you use.
To change the port Glassfish listens on you need to modify the HTTP Listener configuration. On default installations you'll want to change http-listener-1's port. You can do so using the console. But you can also directly edit the domain's domain.xml:
<network-listeners>
<network-listener port="80" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
...
</network-listeners>
Last, to make www.pemis.lk point to that server you need a DNS entry that points to the address the server is attached to. The details of how to do that depend on the comapny that sold you the domain, quite often they have online tools that allow you to enter or modify the name-address mapping. In case of doubt it's best to contact them by phone or mail.
I'm on the same path and, as you don't posted the solution that you found (if you found it), I'll add here some future reference for anyone facing this problem.
I'll break the question in two parts: Eliminating host:port and changing how the URL behave.
I don't have a complete response to the first, however if you chose to listen at port 80, by HTML standard, you will supress the port on the URL, getting half the solution you want.
The second part, changing the URL behavior and/or shortening it can be achieved by either using mod_rewrite in apache or Tuckey's URL Rewrite Filter (http://www.tuckey.org/urlrewrite/). A google search using URL Rewrite can achieve you a more in depth explanation and there's a guide on the website.
You should, however, update your question with an answer, if you found one.

Websitepanel and / or IIS : Create a global DNS / subdomain redirect for users to access the control panel. I.e. cp.whateverdomain.com

As per my subject, I need ideas / help on creating [cp].whateverdomain.com, and loading the control panel when that gets hit.
I want this to be a "global" setting, affecting all domains. I understand binding to a port, but I don't understand how to "bind" the control panel to a [cp] subdomain for all domains.
So basically, user will login through cp.domain.com , instead of domain.com:9001
I would greatly appreciate some insight into how this happens, i.e on other servers / setups. Arvixe uses cp.domain for all control panel access. I am also looking at various other scenario's where I want to use a global subdomain/pointer for different things, hence I would like to "understand" what needs to happen to DNS , IIS, and website panel, to achieve this.
In a nutshell, if I remember correctly, you need an extra IP for unique things such as this. YOu need to "bind" the subdomain to that ip, and it should resolve for all domains on the other ip's. I might be off the track a little, this was a while ago for me. I did not want to offer up one of my ip's for cp, so I just stuck with the port.

CNAME to an A - pointer To webpage

Is it possible to use a CNAME pointer, that points to an A pointer that points to the webapplication?
I've tried this multiple times now, without any success, and i start to think that it is not possible?!
i got this
"Bad request, invalid hostname" think its an 400 error.
If it is not possible to do it this way, can someone please give me some ideas how to start?
My web application:
I got a couple of users registered at my web application.
Each users is supposed to get an sub domain, for example, user1.mydomain.com (A-pointer to web.mydomain.com, where all the aspx filer are)
by reading the domainname I get the userID.
If this is not possible i have to put a lot of files in each domain, which i dont want to do. what would you do?
wildcards is not possible.
Why a cname to a A? i have to take into account that each user maybe want to point their domain to his or her account at my place. so their pointer should be a CNAME...
Thanks!
The problem is that your virtual hosts are not configured to accept requests for the domain the the CNAME record is for.
You need to set the ServerAlias directive (assuming you are using Apache) so it contains all possible variants that you want to use to access your app.
A CNAME record is simply an alias of an A record, so it will always resolve to the IP that the A record points to. What you need to do is tell your web server how to handle those domains (it's based on the Host: header of the HTTP request).
You will find that you have same problem if you create A records for your other subdomains, instead of CNAMEs.
If you need to dynamically add/remove users, you would probably want to use mod_vhost_alias so you don't have to restart Apache every time you do it.
EDIT Sorry, just noticed the reference to aspx, which presumably means you using IIS, which means I can't tell you exactly how to configure it since I know next to nothing about IIS. Re-tag this question with IIS and someone will probably be able to help :-)
ANOTHER EDIT This page from M$ may help you with IIS virtual hosting, although I still don't know how to do it dynamically/programmatically.

IIS: Can I create a host header for an intranet site?

This is a fairly simple question (in my opinion) but for some reason despite my Googling I cannot find a straight answer to it.
Currently I have an application running under my Default Web Site located at http://localhost/myApp. Ideally, I'd like to create a new site in IIS with a binding to 127.0.0.1:80 and a host header of http://myApp so that I can test my url rewriting rules properly (since my app will ultimately be hosted at http://www.myApp.com, not http://www.somedomain.com/myApp).
So, my question is this: will the above work? I haven't had a chance to try it yet.
If the above will not work, what are the steps to be able to access my site at http://myApp on my local network?
It should work provided you fool the OS into resolving www.myapp.com to 127.0.0.1. To do so, edit your hosts file in %systemroot%\system32\drivers\etc to contain the following:
127.0.0.1 myapp.com
I believe you could do just myapp(without the .com) as well, but that gets a bit trickier because how that is resolved depends on your node type. (hybrid, etc) To be safe, add
127.0.0.1 myapp
to BOTH the hosts and LMHosts files in the same directory. By default the lmhosts is non-existent and there is a lmhosts.sam there. You'll have to rename that to just lmhosts or create a new one.
Then create the binding as per usual in IIS7/7.5 (I assume it's 7... Site->Actions->Bindings->Add or Edit->Populate hostname accordingly).. IIS6 will work too but it's alot harder to get https working should you need it.

Resources