Apache Config Steps – Run multiple domains on same ip
November 16th, 2011 § Leave a Comment
Suppose you want to point abc.mydomain.com and mydomain.com to same machine/ip, but to different applications. There are multiple ways to achieve this (basically with same config settings but in different files). I am giving one way here that worked for me:
* Go to /etc/apache2/sites-available
* open a file abc.mydomain.com.conf
* copy this to abc.mydomain.com.conf, make changes to folder path domain name etc. and Save the file
<VirtualHost *:80>
DocumentRoot /var/www/abcappfolder/
ServerAdmin admin@mydomain.com
ServerName abc.mydomain.com
ServerAlias www.abc.mydomain.com
Options FollowSymLinks
AllowOverride None
#we want specific log file for this server
CustomLog /var/log/apache2/abc.com-access.log combined
ErrorLog /var/log/apache2/abc.com-error.log
</VirtualHost>
* Now create another file mydomain.com.conf
* copy this to mydomain.com.conf, make changes to folder path domain name etc. and Save the file. Note that here I am assuming mydomain.com will actually redirect to an app server (like tomcat or jboss) running on port 8080, that’s why you see ProxyPass statements:
<VirtualHost *:80>
DocumentRoot /var/www/mysecondapp/
ServerAdmin admin@mydomain.com
ServerName mydomain.com
ServerAlias www.mydomain.com
Options FollowSymLinks
AllowOverride None
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
ProxyPreserveHost on
#if using awstats
ScriptAlias /awstats/ /usr/lib/cgi-bin/
#we want specific log file for this server
CustomLog /var/log/apache2/mydomain.com-access.log combined
ErrorLog /var/log/apache2/mydomain.com-error.log
# if your machine's name is also mydomain.com
# then you need to use config settings below
# otherwise site will NOT be accessible with mydomain.com
# (although it will be accessble as www.mydomain.com)
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain.com [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301]
</VirtualHost>
* on command line run these commands to enable these 2 configs:
a2ensite abc.mydomain.com.conf
a2ensite mydomain.com.conf
This creates symlinks to the 2 config files in /etc/apache2/sites-enabled folder
You can create the same symlinks manually also like this:
cd /etc/apache2/sites-enabled
ln -s /etc/apache2/sites-available/abc.mydomain.com.conf abc.mydomain.com.conf
ln -s /etc/apache2/sites-available/mydomain.com.conf mydomain.com.conf
* Following step is required only if your machine’s name is also mydomain.com (that means you sftp or ssh to your machine using mydomain.com). In this case I was not able to access my site using mydomain.com in browser. Hence I did this which worked, there may be a different way to solve this problem though:
remove symlink to ln -s /etc/apache2/sites-available/default file from /etc/apache2/sites-enabled folder. You can use rm command or you can run this command
a2dissite default
You do not need to do this for sub-domains (like abc.mydomain.com)
* Restart apache (/etc/conf.d/apache restart)
* Your sites should be accessible now
Note : If it does not work make sure you do not have ProxyPass statements inside httpd.conf or a conf file in /etc/apache2/conf.d to redirect URL
Fatal error: Allowed memory size of 16777216 bytes exhausted
November 16th, 2011 § Leave a Comment
You need to change the maximum memory allowed to a php script to run.
For this you need to open your php.ini (location of this file will depend on where php is installed on your machine). In my case php.ini is in /etc/php5/apache2/php.ini
Open /etc/php5/apache2/php.ini
search for memory_limit
change 16M to 32M
save file, you are good to go!
Steve Jobs
October 11th, 2011 § 1 Comment
Technology serves everyone not only companies or computer geeks. Sitting in a bus or subway with music to ears via ipod, was technology ever that close to public? And the one man who deserves credit more than anyone else is legendary Steven Paul Jobs.
Steve Jobs was a truly technical person. Best depiction of his talent was in innovation of technical ideas and their implementation. He worked on a computer board with Stephen Wozniak before coming up with Apple II computer in 1977, a much advanced computer at that time. with Macintosh his aim was to build a cheaper computer with powerful GUI. NeXTSTEP was his idea of a Unix based operating system. And MAC OS X is basically MAC with NeXTSTEP together. iMac, iPod, iPhone and then iPad apart from several software innovations from Steve and his company took the media world to another level.
As a manager Steve was considered to be erratic and hyper sensitive. To change self nature is a very difficult job but Steve proved he could do it by becoming a very capable CEO of Apple in last decade.
People like Steve are true genius who with their hard work and rare brain help the world make enormous progress in little time. It is sad for the world to not to have him anymore. Steve Jobs will always be remembered as a true visionary.
Javascript – extract Year from Date
June 24th, 2011 § Leave a Comment
If you want to extract year from Date in Javascript, try getFullYear() method instead of getYear(), see the output below on Firefox and Chrome…
Here's the code:
<html> <head> <script langauge="javascript"> var date1 = new Date(); var browser = navigator.userAgent; var dateMessage = "I am on "+browser+"\n\nCurrent Date : "+ date1; dateMessage += "\ndate1.getYear()>> "+date1.getYear()+ "\ndate1.getFullYear()>> "+date1.getFullYear(); alert(dateMessage); </script> </head> </html>
CSS, DIV and Table Wrap Problem
May 19th, 2011 § Leave a Comment
I had this table within a DIV
<div id="tooltip_123" class="tooltip">
<table class="tooltip">
<tbody>
<tr>
<td>
The Business Communication System bundle combines an ADTRAN NetVanta 7100 or NetVanta 7060 with the NetVanta Unified Communications software to give the customer Unified Messaging providing access to voice mail and faxes within an email or desktop client. This solution provides a Fax Server, Personal Assistants, Graphical Drag-and-Drop Service Creation, Call Redirection Services, and Notifications. This solution requires a separate server to run the UC software. A server is not included in the BCS bundle.
Click here for more information.
</td>
</tr>
</tbody>
</table>
</div>
And CSS properties were:
div.tooltip { position: absolute; z-index: 1; white-space:pre-wrap; }
table.tooltip { border-collapse: collapse; width: 250px; color: #000; font-size: 10pt; border-width: 4px; border-color: #013777; }
This is what was showing up on screen
After some research, I changed DIV css to this:
div.tooltip { position: absolute; z-index: 1; visibility: hidden; white-space:pre-wrap; }
and now it wrapped text without any problem and I see this now (white-space:pre-wrap; keeps white spaces as entered and wraps text when required):




