Making a localhost apache webserver go live - apache

I have looked all over the internet and I can't a reasonable way to make my web-server running on apache go live with an unique ip and everything. How would i got about making it live and viewable for other people?

Normally you would not do this. You'd buy a hosting account from some provider like GoDaddy, BlueHost, etc. and put your software there, and make it visible that way. Making your localhost server viewable would involve buying a static IP, which is not cost effective for most people.

I suppose it depends on what you mean by "go live" if you need it to host a specific domain name then yes - get a shared hosting account somewhere ~ if you just need access to it and it does not matter what the domain name is, you can use something like DynDNS: http://www.dyndns.com/services/dns/dyndns/
-sean

Related

CNAME Domain Mapping/forwarding in a Saas Application

I am trying to provide a feature for my users to map their custom domain [ which they will will purchase themselves ] and to their profile/page on my website say client.foo.com, using CNAME domain forwarding.
I have gone through various questions on StackOverflow regarding the same problem but all have focused on creating wildcard subdomains which I have already done and they function well.
Assumptions:
I am currently on a shared hosting, hence shared IP. [I can purchase a dedicated IP if that does the job efficiently.].
I am using apache server hence please suggest the solutions considering the same.
A better explanation of My issue - [Taken from other StackOverflow question, but solutions not as requested]:
I host at fooservice.com. For each user, they get their own subdomain bob.fooservice.com. I'm pretty sure I can get that part covered. Let's also assume that Bob wants the service to appear as a subdomain of his site awesomebob.com. He wants it to be foo.awesomebob.com. I know that what Bob has to do is add a CNAME record from foo.awesomebob.com -> bob.fooservice.com. My question is what do I have to do to make sure that valuable on my fooservice server.
Thank you for all your valuable suggestion well in advance.
Based on your explanation, you use wildcard subdomains, which all have the same IP I assume and you want to automate the process right?
So, as CNAME record is only pointing to the IP address, not redirecting, you need to create virtual host in the first order than other virtual host.
In this virtual host, create a script (index.php) to serve the correct subdomain's page from the requested custom domain.

Google Domain forward to Digital Ocean linux server, running Apache2 subfolder, and display domain as root

I've been googling for a bit now, and I really cant seem to figure this out. I recently bought a domain name with google domains, that I wish to point to a sub domain on my web-server, (example) http://120.0.0.0/sub-folder/, while apearing as domain.com.
Right now I have mbektic.com forwarding to http://138.197.5.88/mbektic/ which kind of gets what I need done, but I wish for the URL to say mbektic.com, instead of the ip address of the server.
Now I've been looking around and I've found things mentioning things from creating records to .htaccess files, and honestly I'm completely lost.
If someone could point me to a straightforward guide or give me a list of steps to follow, I can do it myself, but currently I am just lost.
This really belongs on unix.se since it isn't programming...
That said, what you need to do is set up a DNS A record pointing your domain name to your IP address. Add a second one to handle www.example.com
Then, on the webserver, configure it to respond to that name and serve content out of the directory you specify (the apache webserver calls this the DocumentRoot - you may want to look up apache virtual hosts .... )

Domain names for production / development server best practice

Ok so I have a number of CMSs and eCommerce applications, that require the correct URL (otherwise the links will not work). Of course in my development server, the domain name cannot be the same as the production server... do you guys just do an edit/replace on all files and edit the mysql entries before pushing the development to production server environment? Or is there a better way to do this?
You could just place everything in a directory with a random hex or other valid characters as the name like:
yourdomain.com/XHTEDD12222-112KJK
You might also want to include an entry in your robots.txt file to exclude this directory. This isn't 100% safe, and it is best to use a local server or access the site via IPv6. IPv6 is suggested over IPv4 for security with crawlers. Anything you put up publicly isn't exactly safe.
Once you change the name with one of the above options, you could just refactor your project with the name change. If you go with IP and or local server, you can refactor to that number and it should still work.
You may also look into editing host files to achieve a similar workaround without redirecting DNS servers to point at your development server, but this is OS dependent. Comment your OS and I might be able to help with that.
Lastly, for security, you could include a PHP wrapper for all of your pages that look for a specific IP address in $_SERVER['REMOTE_ADDR'] global variable, but this could get really complicated to implement and I'm unaware of any currently available components that do this.

.htaccess safety vs password

Is is safe to create a .htaccess in a folder in my website (example.com/thisfolderismine) and ONLY allow MY IP address?
My goal is to MAKE SURE that no one else than me access this folder. This is also a login in this folder but I'd rather take a crazy-full access protection.
Is this safe? Is there a way to hack this?
Note: I don't care about not being able to access it from somewhere else.
My website is getting hacked by Ukraine, Vietnam, Philippines, Algeria, China in the last 4 months and these nolife are driving me nuts.
Also, is there a simple way to only allow IP/computers from ONLY Canada & USA? I don't have clients anywhere else anyway.
Thanks a bunch
Joel
Kind of going in reverse order of your question:
While there may be some general association of geographic location to IP address range, you should not count on it.
What if one of your clients in Canada want to access your site through a proxy in Europe? You should use a "real" authentication method to verify users, not IP address.
Using specific IPs is better, assuming those users have static IPs. This not a safe assumption for a dial-up or DSL-based user, though (for example).
If you yourself have a static IP, then yes, it should be fine to limit access to a folder based on that. Of course if you ever release that IP or switch ISP, etc. you will have to update your website's configuration. One more thing to have to remember.
You could also consider using a VPN and only limiting your page's access to the local network (see anubhava's answer - note the 192.168.XX.XX address).
Personally, I use a combination of HTTPS + username + good password for stuff like this.
Put these 3 lines on top of your .htaccess file in the folder you want to restrict:
Order deny,allow
Deny from all
Allow from 192.168.100.101
This will only allow access to that folder from IP address 192.168.100.101 otherwise it will show forbidden error.

How to hide distributed servers under a single domain?

I currently host my company's website and blog on separate servers, reached by separate domain names - www.example.com and www.example.net. This is so I can give blog server access to our partners without compromising security on our main server. However, our SEO guy is now demanding that the blog be put on our main server, as www.example.com/blog.
I would like to maintain the current server separation rather than putting both on the same server. Is there any good way to keep them separated, but have them both under a single domain name? A subdomain would also be acceptable (blog.example.com).
My main website server is a Debian box running Apache 2, and I have full root access to it. The blog server is run by Hostgator, and I have limited access.
Edit: Thanks, all. In this particular situation I don't particularly want to transfer the blog again, and I don't have easy access to the DNS records, so i went with mod_proxy and it worked like a charm. I wish I could give you all "preferred answer" status, though, because all of your information was awesome.
A subdomain would be easy: just create an A record in DNS which maps blog.example.com to the IP address of the blog server, and have another A record in DNS which maps www.example.com to the main website server (this latter record probably already exists).
Would the SEO guy be happy with blog.example.com? It's not the same from an SEO perspective, but it might be good enough for him. I work at a company where SEO is at least 1/3 of what we do, and that's our setup: blog.example.com and www.example.com.
You could try to get fancy and proxy requests to /blog to the 2nd server, if you insist on keeping the blog off your box, but I think you can find a secure way to share space. Proxying like that could get annoying, and it basically doubles the latency to your blog.
Give the blog guys an account on your box; don't give them root/special privileges. If you can get away with it, don't even give them SSH access -- just give them a FTP login (make sure they can't access /var/www), and maybe a mysql account or something. (As you can see, this all depends on how much control/power the blog folks demand.)
Then, just make a symlink to the blog root, so they can write to a restricted area like /home/blog/www and still have it included in the website:
ln -s ~blog/www /var/www/blog
If a subdomain is for some reason not a possible way for you to go, you could use Apache's mod_proxy module to proxy requests to /blog to your second server.