RSSAll Entries in the "Web-hosting" Category

Ubuntu Remote Desktop – multiple users

When I got my new dedicated server setup with Ubuntu server 12.04 LTS, I wanted to use it both for website hosting and multiple users remote desktop work.
It took me some time to arrange all the steps to have the above completed, and as far as the hosting part was pretty easy, the multiple Ubuntu users desktop setup needed some jugs of coffee before start working as I wanted it.

So, I presume you have logged in to your server with some user already, so we will stat with updating the system:

Next, as I want all Gnome desktop features, will install it completely with:

Unity looks fancy, but I want the old Gnome panel, and I do not need “compiz”, so:

Next what we need is a VNC server.

The tricky part here is that you have to create several configuration files for the Ubuntu Remote Desktop user. This is really time consuming if you have to read all the settings and creating the files by yourself.

It is more easy to start the VNC server which will create the files automatically:

You will be asked for a password so enter it, and then kill the server as we have to make some configuration changes:

Edit the xstartup configuration file:

And make it looks like this:

Now you can start the vnc server with this:

Certainly you can change the settings if you want different Remote Desktop geometry.

Now use your preferred VNC client – http://remmina.sourceforge.net/ (Linux) and http://www.tightvnc.com/download.php (Windows) are my suggestions – and connect to the Ubuntu Remote Desktop server using x.x.x.x:2 as (:2) is the number of display used to run for the client. If you have more than one running you should use different number at the end.

As I saying different desktops, I am going to add another user to my Ubuntu Remote Desktop server.
For this I will need to repeat the above steps for creating (and starting) the VNC profile for each user. This one is not yet automatically implemented, but it is not a big deal.
First I will add another user:

Complete the several steps for creating the user which is including creating the password and user personal information.
(A little trick when you want to add user with administrative privileges is to type the command as : adduser admin
)
Then start the VNC server once to create the VNC password:

Open VNC startup file for the ‘newuser’

And paste the same configuration as for the first user:

Save the file and start the service

Now using VNC client you can connect to the new user Desktop as going to x.x.x.x:3 address.

The next step is to automate a little bit the start-up precess for these Ubuntu Remote Desktop users. Otherwise you have to start vnc4server for each user when the server is rebooted.

So, switch to root (it is just more easier) and then create vncserver folder and create file as vncservers.conf:

Inside put the following massive:

Where ‘user’ is the main user you are dealing with (the one we configured VNC for initially) and ‘newuser’ which is the second user are we have created. If you have more users created and the above steps for settings passwords and vnc4srver start-up completed, add more lines accordingly wit (:4),(:5) etc. screens.

Then create startup script for VNC server as:

And put the following lines inside:

Make the script executable, and add it to the startup scripts:

Now:

And all added users in /etc/vncserver/vncservers.conf will be able to connect via Remote Desktop.

Certainly make sure VNC ports are anebled on the firewall.

Also take in mind that VNC is alsways better to be combined with SSH tunnel as its encryption and vulnerability issues are well known.

Tags

Host multiple domains on one hosting – cheating the hosting companies.

I barely remember my first site and how it was created, but I still remember the filling when I saw the price for the webhosting I was searching for. Then I was a student and if I wanted to see my website live, I had to pay one third of my monthly budget. That was before more than ten years and the webhosting was pretty expensive than now.

Nowadays the hosting prices are way to low, but if you are familiar with webhosting and understand the services that some hosting companies provide – you probably know that even price of couple of bugs is too much for what you actually get. I am not going to fail into detailed discussion about hosting companies, plans etc.- so if you are at the point where you do not have much to spend on webhosting, and in the same time you want to start building websites and host them cheep you may use the method described bellow.

Lets consider the following case:
You have bought webhosting which include something like this:
One domain hosted, 160GB drive space, MySQL database, PHP, any-other-marketing-bla-bla . (For Windows hosting users, please read Redirect domain alias to a particular folder in Windows)

Certainly the main point here is that you have pretty much space, PHP and MySQL which allows you to do almost everything, and .. just one domain hosted. Here I have to say that the whole freetutorialssubmit.com website is not more than 600MB and if I decide to host it on such hosting, the rest of the 160GB space will remain unused. You may decide to use the rest of the space as a storage, but in most cases it just remain like that.

With the PHP script bellow you can host multiple domains on one hosting even it the hosting company allows only one domain to be hosted, which will allow you to use the rest of the hosting space for different websites.

Before that I have to mention that all domain you want hosted in this hosting should be set like CNAME for the main domain. The reason is that when a domain is set as a A CNAME record or Canonical Name record in the Domain Name System (DNS) – this specifies that the domain name is an alias of the other domain. This is rather simple and can be done in with the company where the domain is registered for free. (If not try GoDaddy ;)

Once a domain is set as CNAME it will do exactly the same as the first domain. Here comes my script which basically check as which domain the browser request is done and redirects to a particular folder where the according domain files are set. The script should be in the main index.php file, otherwise it will not be opened and will not redirect accordingly.

Ok, it may looks confusing, but what is actually happening is when someone lands on your hosting, his browser opens the main index file. The script checks ‘HTTP_HOST’ global PHP variable which contains actually via which domain the server was reached and then redirects to its index (you can see it in the example as index2.php and index1.php ), or to a particular folder. If there is no match the visitor’s browser will stay in the same file and will continue with the main domain code.

Well that’s it … and yes, it is legal to host multiple domains on one hosting using this way!

301 redirect checker script

This tutorial contains 301 redirect checker script which I have created after spending more than half an hour searching the Internet for something suitable I can use for my needs. While I was searching I found only separate web pages with fields where you can check one – two URLs or heavy applications that can be installed, and yet not covering my needs. Certainly, there were paid 301 redirect checker solutions which can be used to check 301 Permanent Redirect, but I am not sure whether it does worth to buy such. The purpose of this checker in most cases is only to see if a particular pages redirect permanent covering the SEO (Search Engine Optimization) requirements.

In my case part of the OnlineHowTo.net is moving over Free Tutorials Submit dot com, and from SEO perspective, the tutorials moved have to be with 301 redirect to their new URLs.

I decided to write it as Linux bash 301 redirect checker script because it can be run on almost any Linux machine with curl installed and easily added to the Crontab. I believe the script is rather easy to be understood and used, even by not so experienced administrators.

What the redirect script is doing is to gather the URLs you want to check from an external file (in my case: /opt/scripts/301URLs.txt ), where every URL is placed on a separate line like this:

I chose this way as most of the get-all-urls-from-domain applications provide the listing like this, but certainly you can choose (and then modify a little bit my script) different format.
Then using simple bash loop it reads every line one by one, processing it with CURL extracting the headers (curl -I option).
Every header contains information similar to:

Once we have this information we can easily egrep for the 301 Moved Permanently part and if it exist, the 301 redirect checker script continues with the next URL. If the redirect is something different it writes down the URL into the /tmp/301report.txt file.

Finally the script checks whether the /tmp/301report.txt file exist – it will be created only if there is even one different from 301 Moved Permanently redirect – and will send it via e-mail to the address you have set in the EMAIL variable. If there are no such file, the script will end with no report.

Here is the whole script which you can freely use and modify as per your needs:

 

To be honest, I am using a little bit modified 301 redirect checker script, which is also checking whether the redirected URL is the one I need, but it is more complicated and may confuse you if you have to modify it.
Also, more elegant solution will be if you decide to use array, but this redirect checker script fits my needs perfect.
Also I have put sleep command as if the number of the URLs is too big, it may lead to server abuse and blocking the IP you are checking the redirect from. If you do not need the script to wait 5 seconds for every URL, just remove that line.

Hope this scrip will cover your needs as well. Your comments and suggestions are welcome.

Tags

How to add avatar to my forum profile.

This tutorial will show you how you can easily add avatar picture or image to a forum profile.

For the example I will use one really fast and free avatar hosting site logically named AvatarHosting.net.

I choose it because there is no need of account sing up and takes about 20 seconds to host your avatar.

First go to http://www.avatarhosting.net (copy and paste that link or click on free image hosting).

Tags

Adding image hosting site picture link to website

With this tutorial I will show you how you can use free image hosting to link pictures to your webpage.

I will use AvatarHosting.NET site which is very easy to be used, no need to create and account and provide reliable image hosting service.

First go to http://www.avatarhosting.net (copy and paste that link or click on free image hosting).

Free eBay Picture Hosting

As you certainly know eBay is: ‘online auction and shopping website in which people and businesses buy and sell a broad variety of goods and services worldwide‘.

These good people provide one really good marketplace, and certainly they want to earn money from it.
They have several taxes, but probably the most annoying (for me) is for the picture hosting.

That is why I prefer so called eBay Self Picture Hosting option, and this will be the matter of this tutorial: Free eBay Picture Hosting.

For that purpose I am using one really good site called AvatarHosting.net, and I think it is good because even it is free picture hosting site, also it is fast. I tried to host some pictures on imageshack but sometimes the pictures are loading so slowly, so I am sure I am loosing money because of this. They have separate eBay picture hosting section where your pictures are hosted and do not appear trough the site.

So, let us see we can use Avatar Hosting .net for Free eBay Picture Hosting.

Open the home page of Avatar Hosting .net, then at left you will see the upload section.

Choose there browse and locate the picture you want to host for eBay Sales.
Then eBay pictures category, click on private if you do not want to share your images with others and write down your e-mail where the link codes will be send.

It should look similar to this(click on the image to enlarge it):

Tags

Preview website without IP change

You will find this tutorial about how to set IP address for a domain name (website) manually in hosts file on Windows useful in case you are transferring your domain from one company to another, and the domain is still not pointed to the new hosting IP address. Basically this will allow you to preview website without DNS change.
Another case is if you just want to domain name instead of IP address. We all know that Onlinehowto.net is easiest to be remembered instead of 66.235.184.90 (the IP of the hosting).
Certainly you just can do a joke with someone as setting often used domains like Google.com, Yahoo.com, MSN.com to point to a different IP address.
Here I will tell that this is common trick used by hackers to set Yahoo.com (for example) to point to an IP on a server where exactly the same (as Yahoo’s) web page will be set, but the login form there will just still your password and generate error message line ‘Incorrect password’ and will forward you to the real website.

Anyway, how this can be done? How to preview website without IP change?

This can be done in a file called ‘hosts’, and all Windows OS’ are using it to define certain domains or IP addresses.

The mentioned file is always located into the ‘%SYSTEMROOT%\system32\drivers\etc’ folder. Usually this is ‘C:\WINDOWS\system32\drivers\etc’, but it depends on where your Windows is installed.

For example if you copy the next string:

%SYSTEMROOT%\system32\drivers\etc

And paste it into Windows Explorer like on the next picture, when you hit Enter, you will be directed to the ‘hosts’ file location.

Windows hosts file location

The address will be converted as per the Windows installation location C:\WINDOWS\system32\drivers\etc\.

Hosts file directory content

Now locate the file called ‘hosts’ and open it with your preferred text editor. My advice is to use Notepad to avoid any special characters in this file.

The Windows ‘hosts’ file content by default is:

As you can see this file describe itself, and what it is doing is the mappings of IP addresses to host names.

There is always one record for the local host and as you can see I have set up mywebsite.com to point to a local IP address where I am running Web server.

If you open this domain in your browser, you will see the original website. In my case it will open a page which I am using for creating tutorials.
For example you can see how this trick is used in this tutorial:

Setup a website in IIS on Windows Server

Just add an entry to the hosts file and save it. Then all your browsers will open the new location allowing you to preview website without IP change, and all FTP clients, etc. will open it from the new IP address as well.

Apache MIME type configuration to open .docx .pptx .xlsx MS Office files

I had some issues recently with the new MS Office files like: .docx .pptx .xlsx – opening up from Internet Explorer as ZIP or other type files.

It really depends on the Apache MIME type configuration for the .docx, .pptx, .xlsx, etc files.

The official MIME type configuration for MS Office 2007,2008 files is this one:

Tags

Fast and easy avatar, image and picture hosting with AvatarHosting.net

With this tutorial we will promote one excellent website for picture, image and of’ course avatars called AvatarHosting.net.

Recently we started a good relationship with this site as the image hosting method there is very fast and easy and do not require any kind of registration.
In the same time the site will provide you with ‘copy and paste’ links of the picture and its thumbnails, which can be used directly on your site, in forums, blogs, MySpace, Facebook, eBay picture hosting etc.
Also you can simply upload and share funny images or pictures of yours with few clicks.

This advantage is well used with our site helping us with some of the images included in our tutorials.

With a few steps I will show how useful is this website.

First visit the site at AvatarHosting.net.

You will see rather different view from the one on the image bellow, but I crop it just to show you the core part of the home page.

PHP forwarding

This tutorial will explain how you can forward a web page to other URL using PHP forwarding.
It will be useful when you do not want to use other way of forwarding, like .htaccess permanent redirect, META redirect, Java redirect, etc.
This type of forwarding can be used only on a server with running PHP on it.

Tags