Archive

Archive for the ‘Apple/ MAC’ Category

How to configure Railo – Tomcat – Apache on MAC Lion Mountain 10.8

January 22, 2013 5 comments

Last week I updated my operating system from Snow Leopard  to Lion Mountain 10.8, system has upgraded itself.

Only two problems I faced:

1) Little Snitch got removed (V 2.2), I had to buy Licence for upgrade of version 3.02 – Lion cost me more 😦

2) I had ColdFusion 9.01, which stopped working as Lion upgrade had reinstalled Apache removed old httpd.conf and httpd-vhost.conf files (actually renamed them as httpd.conf~previous.

I tried to move virtual sites from old to new but it didn’t work.

Web Sharing option got removed from System Preference – To get it back I found this post which provides a tool to get it in Sys Pref under Other:

Explanation, good article to read: Restore Web Sharing in Mountain Lion 

Get the tool from here: WEB SHARING IN OS X MOUNTAIN LION

I made few changes to Apache config files, by default it uses web server document folder here:

/Library/WebServer/Documents

I have changed this and few other settings in httpd.conf (/private/etc/apache2/)

1) Find ServerAdmin and change email address to yours one (around line no 153)

2) Find ServerName and change it to cfdev also add following in hosts file (/private/etc/)

127.0.0.1 cfdev  (now you can get to your webserver by localhoost/ cfdev/ 127.0.0.1)

Make sure you uncomment this line (at line no 481) Include /private/etc/apache2/extra/httpd-vhosts.conf

3) create a folder sites or whatever name you waant to give at root level

4) Find DocumentRoot (line no 169) and change it to “/sites”

5) Find < Directory and change it with “/sites”

6) Open file httpd-vhost.conf from /private/etc/apache2/extra/

7) Uncomment NameVirtualHost *:80 (Line no 19)

8) Add following virtual host (default) site

<VirtualHost *:80>
DocumentRoot “/sites”
ServerName cfdev
DirectoryIndex index.html

</VirtualHost>

9) Add / Create index.html in /sites folder as a place holder

10) sudo apachectl restart (to pick-up the changes

now open browser and browse http://cfdev or http://localhost and you should see your default web page

Railo Installation:

Download your railo installer from here

Scroll down and pick MacOS installer infront of Railo Server with Tomcat 7 title

Open it up and follow the default steps:

It will normally Install under this location and picks port 8080 – /Library/Railo/tomcat/

now if you browse http://localhost:8080/ you should see the tomcat page

1) Open web.xml from tomcat/conf folder

Add following at around line 422 (This will help if you use CFWheels frame-work

<servlet-mapping>
<servlet-name>GlobalCFMLServlet</servlet-name>
<url-pattern>/rewrite.cfm/*</url-pattern>
</servlet-mapping>

2) Open server.xml from tomcat/conf

3) go to line no 90 and un comment following:

<Connector port=”8009″ protocol=”AJP/1.3″ redirectPort=”8443″ />

This will help us to use apache server on port 80 to create virtual sites.

at around line 123 you will see default website for this Tomcat server

create a folder under /sites folder – which will be your first local site say – firstSite

inside the folder create index.cfm

now create a virtual site in server.xml like this: (above </Engine>)

<Host name=”dev.firstsite.com” appBase=”webapps”
unpackWARs=”true” autoDeploy=”true”
xmlValidation=”false” xmlNamespaceAware=”false”>
<Context path=”” docBase=”/sites/firstSite”/>
</Host>

save the file and restart the server (Tomcat):

4) open terminal window and go to /Library/Railo/tomcat/bin

run following command: sudo sh shutdown.sh (to shutdown the server)

Now run this command to start it: sudo sh startup.sh

5) add following in hosts file: 127.0.0.1 dev.firstsite.com

now browse http://dev.firstsite.com:8080 and you will see your first site index.cfm running

6) open httpd.conf from /private/etc/apache2/

add following (Thanks to Anuj Gakhar this post)

<Proxy *>
Allow from 127.0.0.1
</Proxy>

ProxyPreserveHost On
ProxyPassMatch ^/flex2gateway/(.*)$ ajp://localhost:8009/flex2gateway/$
ProxyPassMatch ^/messagebroker/(.*)$ ajp://localhost:8009/messagebroker/$1
ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://localhost:8009/$1$2

now open httpd-vhosts.conf from /apache2/extra/ folder and add virtual site (key to this set up is you need to add virtual site pointing to the same folder with same url under both servers)

<VirtualHost dev.firstsite.com>
DocumentRoot /sites/firstSite
DirectoryIndex index.cfm
<Directory “/sites/firstSite”>
AllowOverride All
Order allow,deny
Allow from all
Options +Indexes
</Directory>
ErrorLog firstsite.error.log
LogLevel warn
</VirtualHost>

restart your apache server and

browse http://dev.firstsite.com  and you should see your site running on port 80

 

Magento Site builder and issues on Mac and PHP

May 20, 2012 Leave a comment

I decided to use Magento (eCommerce Platform for Growth) to build an e-commerce web site as it was suggested by one of my friends and I had seen good reviews of it. I downloaded community version and wanted to play with it. There is another option which they call Magento.go

I opted for the second option to download the site (Downloader).

The first problem I hit was the problem of mcrypt module for php which wasn’t included in my default php install on my Mac 10.6.8. I looked at web and found one solution which was to build the module and recompile the php from source.

Here is the link for the solution

It was little tricky to recompile as I had php version 5.3.8 and first I tried with the same version and it didn’t work and found some where that even I have 5.3.8 on my Mac 10.6 still I need to build mcrypt module using 5.3.6 (means had to do it twice:( ).

I had to put the directive in my php.ini file like this.

extension=/SourceCache/php-5.3.6/ext/mcrypt/modules/mcrypt.so

And another thing happened to me after this was my php tags like this stopped working

<?= phpinfo(); ?> Though following were working fine

<?php phpinfo(); ?>

Later I figured out that they call it short tag and to fix it I need to add following line in php.ini.

short_open_tag = On Here is the link for details reg this

Regarding Magento solution I was expecting it to be less painful experience but  it wasn’t the case. There aren’t good help/ tutorials available on web.

Hope my experience can help someone.

How to find Tomcat version on MAC OS (Snow)

October 24, 2010 Leave a comment

Here are the steps to find which version you are running on your MAC OS (Snow – Leopard 10.6.4)

Open Terminal window

Locate your tomcat installation:

cd /usr/local/<tomcat dir>/bin <enter>

run following command:

sh version.sh <enter>

The above command will return following info:

Server version: Apache Tomcat/6.0.20
Server built:   May 14 2009 01:13:50
Server number:  6.0.20.0
OS Name:        Mac OS X
OS Version:     10.6.4
Architecture:   x86_64
JVM Version:    1.6.0_20-b02-279-10M3065
JVM Vendor:     Apple Inc.

The first line tells you which version you are running on your machine.

Categories: Apple/ MAC, Tomcat

Web multimedia: 6 reasons why Flash isn’t going away

August 19, 2010 Leave a comment

I was reading an article on Computer world and I was very impressed with the content and wanted to share this in here: Its a 4 page article

Article 6 reasons Flash / HTML5 on Computer World

Here are few points I liked most in the post:

Page 1:

“Quite frankly, Flash is a great animation tool, and it’s used for a lot of interactivity. Those kind of interactive elements are difficult to do in HTML 5,” Barberich says.

Page 2:

Although YouTube (which is owned by Google) is experimenting with HTML 5, content protection is one of the reasons why the site still needs Flash, said John Harding, a software engineer for YouTube

Page 3:

Perhaps the most widely reported of these efforts is the open-source Smokescreen project. Developed by RevShock, a mobile ad start-up, Smokescreen shows promise in its initial form, but its performance doesn’t match what users get with Flash content that runs natively. “Smokescreen exemplifies the immaturity of HTML 5,” says Rubin.

Page 4:

Largely lost in all the HTML 5 vs. Flash rhetoric is the possibility that the two technologies might simply work side by side. “I’m never really sure why HTML 5 and Flash can’t co-exist,” says Cote, “why it’s a zero-sum game.”

Rubin of NPD predicts that “within the next few years, we will likely see sites support both technologies. They will be able to achieve much of what they’ve traditionally done with Flash with HTML 5, but there’s no doubt that Flash will also continue to evolve and offer incentives to maintain its developer support.”

It is worth reading the article if you are in web development.

Categories: Adobe, Apple/ MAC, HTML5, iPhone

Mac OS X: Show hidden files and folders in Finder

July 24, 2010 Leave a comment

I wanted to delete folders from Finder on MAC but you can’t see folders (hidden or folders starting with .(dot) i.e. .svn. I am very poor at remembering unix commands, that’s why I have decided to put it here:

Delete from Terminal window:

Locate the folder where you want to perform this action:

command:

rm -r f <foldername>

‘r’ is for recursive and ‘f’ overrides permissions

You can change the Finder view to show hidden folders and then delete in Finder window, you need to run following command in Terminal window:

defaults write com.apple.finder AppleShowAllFiles -bool true

and now you run following command to kill the Finder window and open new window which will show the content:

killall Finder

This will show all your hidden files but your finder window can be messy, after you have done your deletion you can revert back your Finder into its normal view options by reversing the command:

defaults write com.apple.finder AppleShowAllFiles -bool false

killall Finder

Thats it.

Categories: Apple/ MAC Tags:

Configuring Secure Virtual Host on Mac OS X

May 23, 2010 Leave a comment

I had requirement to test my Flex Application, which I build for Raileasy in Secure environment.
It was quite difficult to configure my Mac, as I couldn’t find a good post/ Blog or any article on it.
I asked few of my friends, who are using Mac for their development work and only Andy Allan gave me few tips and links:

Following are the articles helped me to set-up my Mac:
1) Mark Liyanage – article on Configuring mod_ssl on Mac OS X

2) Generating an SSL Certificate with Apache+mod_ssl

Here are the steps I took to configure my Mac (which are based on above articles):
First Open a terminal window and type in these commands:

  • sudo -s
  • cd /etc/apache2
  • mkdir ssl
  • chmod 700 ssl
  • cd ssl
  • gzip -c –best /var/log/system.log > random.dat
    (This step will create a file with the name and zip the file, which we will use to generate key)
  • openssl rand -rand file:random.dat 0

I was looking for a certificate to put on my local machine (which is self signed certificate) and to get that, here are the steps I took:
Issue following command in the already opened terminal window (which should be all in one line):

Before run the command get following questions answers ready:
***********
* Country Name (2 letter code) [AU]:GB
* State or Province Name (full name) [Some-State]:London
* Locality Name (eg, city) []:London
* Organization Name (eg, company) [Internet Widgits Pty Ltd]:Dev Co.
* Organizational Unit Name (eg, section) []:Development
* Common Name (eg, YOUR name) []:www.yourlocal.com
* Email Address []:admin@yourlocal.com
(It’s important that you enter the host name of your web server exactly as it will be used later on in the “Common Name” field, like http://www.yourlocal.com or ssl.yourlocal.com.)
***********
COMMAND to run in terminal window:
openssl req -keyout privkey-2010.pem -newkey rsa:1024 -nodes -x509 -days 365 -out cert-2010.pem

Make sure that “TextEdit” is not running, then type these lines into the terminal window:

  • chmod 600 privkey-2001.pem
  • chown root privkey-2001.pem

On Mac Snow – Apache comes with default config file for SSL
Open following files in any text editor

/etc/apache2/httpd.conf (main config file for Apache)
/etc/apache2/httpd-ssl.conf

1) In ssl.config file look for
VirtualHost definition
You would see like this:

But above setting didn’t work for me, I had to change it to like this, and I don’t know the reason though, but it worked:

Change the DocumentRoot to the right root for your web site.
You might need to Add Directory access rights for the document root:

allow from all
Options +Indexes

Find the following and change them with right path and file name:
SSLCertificateFile “/etc/apache2/ssl/cert-2001.pem”
SSLCertificateFile “/etc/apache2/ssl/cert-2001.pem”

Save the file

You need to un-comment following line in httpd.conf file
#Include /private/etc/apache2/extra/httpd-ssl.conf

Save the file

from terminal window

run pwd command and make sure you are at
/etc/apache2/

run following commands:
apachectl stop
apachectl start
Now your server will provide secure access to your website.

The one thing I didn’t understand was, by doing tis, all of my local website turned into secure websites.

But I was able to test my website under secure environment.

Thanks to the writers of above articles.

🙂

Few helpful links for MAC

May 19, 2010 Leave a comment
Categories: Apple/ MAC, MAMP, Railo, sqlLite