Friday, October 12, 2012

Installing Ramaze on Ubuntu 12.04

Installed Ramaze on my Ubuntu 12.04.

1. Resources
 (a) Ramaze home: http://ramaze.net/
 (b) My previous installation: Installing Ramaze on Ubuntu (11.04)

2. Installation
$ sudo gem install ramaze
[sudo] password for socrateos: 
Fetching: rack-1.4.1.gem (100%)
Fetching: innate-2012.03.gem (100%)
Fetching: ramaze-2012.04.14.gem (100%)
Successfully installed rack-1.4.1
Successfully installed innate-2012.03
Successfully installed ramaze-2012.04.14
3 gems installed
Installing ri documentation for rack-1.4.1...
Installing ri documentation for innate-2012.03...
Installing ri documentation for ramaze-2012.04.14...
Installing RDoc documentation for rack-1.4.1...
Installing RDoc documentation for innate-2012.03...
Installing RDoc documentation for ramaze-2012.04.14...

3. Test Installation
$ ramaze --version
2012.04.14
$ irb
irb(main):001:0> require "ramaze"
=> true
irb(main):002:0> exit
4. Create an Application
$ cd /work/ruby/ramaze
$ ramaze create myapp
The application has been generated and saved in myapp
$ cd myapp
$ ls -la
total 44
drwxrwxr-x 8 socrateos socrateos 4096 Oct 12 23:51 .
drwxrwxr-x 3 socrateos socrateos 4096 Oct 12 23:51 ..
-rw-r--r-- 1 socrateos socrateos  385 Oct 12 23:51 app.rb
-rwxr-xr-x 1 socrateos socrateos  701 Oct 12 23:51 config.ru
drwxrwxr-x 2 socrateos socrateos 4096 Oct 12 23:51 controller
drwxrwxr-x 2 socrateos socrateos 4096 Oct 12 23:51 layout
drwxrwxr-x 2 socrateos socrateos 4096 Oct 12 23:51 model
drwxrwxr-x 4 socrateos socrateos 4096 Oct 12 23:51 public
drwxrwxr-x 2 socrateos socrateos 4096 Oct 12 23:51 spec
-rwxr-xr-x 1 socrateos socrateos  576 Oct 12 23:51 start.rb
drwxrwxr-x 2 socrateos socrateos 4096 Oct 12 23:51 view
5. Run
$ ruby start.rb
D [2012-10-12 23:52:07 $31631] DEBUG | : Using webrick
I [2012-10-12 23:52:08 $31631]  INFO | : WEBrick 1.3.1
I [2012-10-12 23:52:08 $31631]  INFO | : ruby 1.9.3 (2012-04-20) [x86_64-linux]
D [2012-10-12 23:52:08 $31631] DEBUG | : TCPServer.new(0.0.0.0, 7000)
D [2012-10-12 23:52:08 $31631] DEBUG | : Rack::Handler::WEBrick is mounted on /.
I [2012-10-12 23:52:08 $31631]  INFO | : WEBrick::HTTPServer#start: pid=31631 port=7000

6. View
http://localhost:7000

Wednesday, October 10, 2012

Changing Apache port number

I've changed apache default port 80 to 8000.

1. Resources

Creating a web server to host Ruby on Rails and PHP using Phusion Passenger, Nginx, and Apache


2. Back up original port config file

$ cd /etc/apache2
$ sudo cp ports.conf ports.conf.bak.original


3. Change the port

$ sudo gedit ports.conf

From:

NameVirtualHost *:80
Listen 80

To:

NameVirtualHost *:8000
Listen 8000


4. Change the virtual host

$ cd /etc/apache2/sites-enabled
$ sudo gedit 000-default

From

<VirtualHost *:80>
...
</virtualhost>

To

<VirtualHost *:8000>
...
</virtualhost>


5. Restart the Apache

$ sudo /etc/init.d/apache2 restart


6. Test

http://localhost:8000













http://localhost:8000/phpinfo.php