Tuesday, 9 June 2015

Creating sub-domain in Apache2, Ubuntu 14.04

It is quite simple to add a sub-domain to an existing ubuntu hosting account. You just have to follow few simple steps:-

Step 1 : Go to your domain provider and then login to your account.(For example, let's suppose I'm having godaddy account.)

Step 2 : Click on domains, and then choose a domain for which you want to add a subdomain.

Step 3: Now, click on DNS File Zone, then click on add record and then select record type: A (Host), Host: your sub-domain, points to: your IP Address and TTL: any option from dropdown.

Step 4 : Finally, click on finish and save.

Now, you have to move on second part i.e. the ubuntu hosting account which you want to access through this sub-domain.

Step 1: Login to your hosting account and type the following command to access  000-default.conf.
nano /etc/apache2/sites-available/000-default.conf

Step 2:  Add this piece of code in this apache default configuration file:-
<VirtualHost *:80>
ServerAdmin webmaster@example.com
ServerName blog.example.com
ErrorLog $(APACHE_LOG_DIR)/error.log
CustomLog $(APACHE_LOG_DIR)/access.log combined

Here is the snapshot:-

Step 3: To save this file press CTRL+X, then Y and then ENTER.

Step 4: After that, you have to restart your apache server. To do this, type following command:
service apache2 restart

All done! You have successfully added a subdomain to your existing ubuntu hosting account...

Monday, 9 March 2015

XAMPP Server Error: Port 80 in use by "........." with PID .....!

Hey Friends! If you are using XAMPP control panel to host your web applications/projects on your local machine and you are facing a problem related to the port. Then no need to be worried, as it's very often.

Now let me tell you how this error actually looks like. In my case, when I try to start Apache server under XAMPP control panel, it gives me an error which exactly looks like this:

Well I think its not a problem or any kind of error, its just a warning message to you that the particular port you are requesting is being used by some another program, as in my case you can easily see, this port is being used by PRTG Netwotk Monitor.

Actually, By default port no:80 is used by any server to perform an http request. So, If you are facing same kind of problem you can resolve this very easily as you will have to just change the port number in httpd.conf file.

Now lets have a look on what I did:

Step 1: Go to C drive (in case of windows)/xampp/apache/conf/ and open httpd.conf file in notepad++ or any text editor.

Step 2: Change port no: 80 to 81 at three places (line 57, 58 and 219)as shown in picture below.

Step 3: Save the file and restart your apache server(by clicking start button in XAMPP control panel).

All done you are!
Enjoy your projects...!!!