what is cloud hosting – Know In detail

In now day many times we heard about cloud hosting and cloud computing. Recently we heard from Matt (WordPress founder) also. Many web designers are not aware with cloud hosting.

In this article I am going to write about in detail about cloud hosting. We are heard about messaging servers and big web services.

what is cloud hosting – Know In detail

Twitter is the biggest mirco blogging website in the world and they are running like more than 100 mongrel server instances on Nginx server for handling the twitter. But still they are facing lot of traffic issue. May be there are multiple reasons. But still one of that is Rails. How much requests single mongrel instance can handle and if they got billions of hits in single second. What will happen we never no.

Who are in server administration they will defiantly have good idea about these issues.

What is cloud hosting?

Cloud hosting is nothing but multiple virtual machines which are basically does load balancing.

Generally, website hosted on a cloud hosting operates on a clustered servers where online operations are not limited to a single server. By handling security, load balance and hardware resources virtually, the website has access to the processing power of a number of servers that are distributed in real-time.

Cloud computing is a way of computing, via the Internet, that broadly shares computer resources instead of having a local personal computer handle specific applications.

I can say Cloud hosting is solution for multiple dedicated servers. Handling multiple dedicated server is really pain. So for high traffic websites choosing the cloud hosting is the best option.

Google, Yahoo, MSN, Facebook many companies are already using the cloud hosting for better performance.

For choosing the cloud hosting there are few good options present in market. Some of few as follows:

1. Amazon

what is cloud hosting - Know In detail
what is cloud hosting – Know In detail

2. gogrid

what is cloud hosting - Know In detail
what is cloud hosting – Know In detail

If you want information about wordpress cloud hosting then check following URL:

https://purabtech.in/cheap-hosting-wordpress-blogs-sites/
https://purabtech.in/best-hosting-providers-themes-for-wordpress/

add www to domain name through apache or htaccess

We given the detailed information about how to add www to domain name through apache or htaccess. Using apache rule we can achieve this.

add www to domain name through apache or htaccess
add www to domain name through apache or htaccess

Just use following code in apache configuration file or .htaccess file.

If you are using the shared hosting then please go with only .htaccess file.

Just copy paste following code in .htaccess file.

<IfModule mod_rewrite.c>

Options +FollowSymlinks

RewriteEngine On

RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.wordpressapi\.com$ [NC]

RewriteRule ^(.*)$ http://www.purabtech.in/files/$1 [L,R=301]

</IfModule>

How to start Activemq with XML configuration file

how to start the Activemq with XML configuration file. in this article we given you step by step guide of activemq with XML configuration which will simple

How to start Activemq with XML configuration file

You can download Aapache activeMQ from following URL;
http://activemq.apache.org/activemq-530-release.html

Choose the your OS(Linux/Windows). After downloading apache-activemq-5.3.0-bin.zip.
Extract the ActiveMQ. Open command prompt and go to activeMQ/bin directory and run the “activemq” command.

ActiveMQ will start without configuration.
If you are running ActiveMQ on local machine than you can open the ActiveMQ’s Admin from following URL;
http://0.0.0.0:8161/admin/ (8161 is default port)

If you want to run ActiveMQ with XML file. Use following command
#bin/activemq xbean:file:../config.xml

server-status How to start Activemq with XML configuration file
How to start Activemq with XML configuration file

For more information Please visit the http://activemq.apache.org/

How to use hosts file on Mac, Windows and Linux

The hosts file is a computer file used by an operating system to map hostnames to IP addresses.
On many operating systems, the host file content is used preferentially over other methods,
such as the Domain Name System (DNS). Unlike DNS, the hosts file is under the control of the local computer’s administrator

Locate the file “Hosts” on your computer:
Windows
Windows 95/98/Me c:\windows\hosts
Windows NT/2000/XP Pro c:\winnt\system32\drivers\etc\hosts
Windows XP Home c:\windows\system32\drivers\etc\hosts

Linux
/etc/hosts or /etc/host.conf or /etc/nsswitch.conf

Symbian
C:\system\data\hosts

Mac OS
/private/etc/hosts or /etc/hosts

In that file you can edit entry like this

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost localhost yourlocaldomain.com , example.com
::1 localhost6.localdomain6 localhost6
192.168.2.200 intranet

directory.example.com 71.155.186.91

How to setup mongrel cluster setup on fedora

First install the following gems:
#su
#gem install mongrel
#gem install mongrel_cluster
#cd project_name
#mongrel_rails cluster::configure -e production -p 3000 -N 3 -c /home/siwan/project_name -a 127.0.0.1 —-prefix /project_name
# mongrel_rails cluster::start

You are able to start your applicaton at http://127.0.0.1:3000, http://127.0.0.1:3001 and http://127.0.0.1:3002

for all the cluster
# mongrel_rails cluster::stop

Advanced prepairation for production realeaze
$ mkdir /etc/mongrel_cluster

#vim /etc/mongrel_cluster/project_name.yml
copy and paste following text;
user: project_name
cwd: //home/siwan/project_name
log_file: /home/siwan/project_name/mongrel.log
port: “3000”
environment: production
group: dev
address: localhost
pid_file: /home/siwan/project_name/tmp/pids/mongrel.pid
servers: 3

or you can run the following command

or copy and paste the content from config/mongrel_cluster.yml file to /etc/mongrel_cluster/project_name.yml

# ln -s /home/siwan/project_name/config/mongrel_cluster.yml /etc/mongrel_cluster/project_name.yml

Then open your httpd.conf file for apache configration:

<Proxy balancer://project_name>
BalancerMember http://127.0.0.1:3000
BalancerMember http://127.0.0.1:3001
BalancerMember http://127.0.0.1:3002
</Proxy>

<VirtualHost *:80>
ProxyPreserveHost On
# Avoid open you server to proxying
ProxyRequests Off
# Options +FollowSymLinks
RewriteEngine On

RewriteRule ^/(images|stylesheet|javascript|html)/?(.*) /home/siwan/project_name/public/$0 [L]
ServerAdmin siwan@yahoo.co.in
DocumentRoot /home/project_name/
ServerName example.com
RewriteRule  ^/(.*)$  balancer://project_name%{REQUEST_URI} [P,QSA,L]
</VirtualHost>

Restart the apache server
#/etc/init.d/httpd restart

Command for restart the mongrel servers from any where
# mongrel_rails cluster::restart -C /etc/mongrel_cluster/project_name.yml

Solved: Access denied with code 400 (phase 2).

When I restarted my apache server. I am using the fedora 9 here.

I did not get my default page opened in browser.
When I opened the apache error log file. I saw following error.

ModSecurity: Access denied with code 400 (phase 2). Pattern match “%0[ad]” at REQUEST_HEADERS:Cookie. [id “950910”] [msg “HTTP Response Splitting Attack. Matched signature <%0a>”] [severity “ALERT”] [hostname “localhost”] [uri “/”] [unique_id “SuWoGH8AAAEAAFF3rKEAAAAA”]

I after doing some R&D but I did not got any perfect soluction.
Then I cleared the whole browser cookies. That solves my problem.

solution – clear the browser cookies…

Solved: DirectoryIndex not allowed here

When I tried to run my one of my project on server I got following error on the Browser.:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

When I got above error I opened the error log file.

Error Log File log(#vim /var/log/httpd/error_log)
[Wed Oct 14 12:02:56 2009] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Wed Oct 14 12:02:56 2009] [notice] mod_python: using mutex_directory /tmp
[Wed Oct 14 12:02:56 2009] [notice] Apache/2.2.9 (Unix) DAV/2 PHP/5.2.6 mod_python/3.3.1 Python/2.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g mod_perl/2.0.4 Perl/v5.10.0 configured — resuming normal operations
[Wed Oct 14 12:02:59 2009] [alert] [client 127.0.0.1] /var/www/html/your_domain_name/.htaccess: DirectoryIndex not allowed here, referer: http://your_domain_name.org/
[Wed Oct 14 12:03:29 2009] [alert] [client 127.0.0.1] /var/www/html/your_domain_name/.htaccess: DirectoryIndex not allowed here, referer: http://your_domain_name.org/
[Wed Oct 14 12:11:13 2009] [notice] caught SIGTERM, shutting down
[Wed Oct 14 12:11:13 2009] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Oct 14 12:11:13 2009] [notice] Digest: generating secret for digest authentication …
[Wed Oct 14 12:11:13 2009] [notice] Digest: done

At the end of file I saw above error.

When I saw that I opened the httpd.conf file and I searched for line.

AllowOverride None

I commented this line.
#AllowOverride None

Then I added following lines to that tag
Order allow,deny
Allow from all

Then I saved the httpd.conf file and restarted the apache server.

This solved the my issue.

solved: [warn] _default_ VirtualHost overlap on port 80, the first has precedence

Here I am using the Fedora 9 for this example. I solved the issue of _default_ VirtualHost overlap on port 80 warning in linux

If you want to host many sites on one computer or machine.
I added following lines to httpd.conf file(end of file).

[viral-lock message=”Solution code is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]

<VirtualHost  *:80>

Options +FollowSymLinks
ServerName example1.com
DocumentRoot /var/www/html/example1

VirtualHost>

<VirtualHost  *:80>

Options +FollowSymLinks
ServerName example2.com
DocumentRoot /var/www/html/example2

</ VirtualHost>

[/viral-lock]

When I restarted the apache server using following command.
#su
#ROOT_PASSWORD
#/etc/init.d/httpd restart

I got the following error;
[warn] _default_ VirtualHost overlap on port 80, the first has precedence

Again I opend the httpd.conf tile and I read following lines;
#
# Use name-based virtual hosting.
#
#NameVirtualHost *:80

# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

Than only I uncommented following line and restarted the Server.

NameVirtualHost *:80

My promlem get solved.

Solved issue -Directory index forbidden by Options directive:

I want to change the default location of Apache folder which is (var/www/html).
I am using the Fedora as OS and apache 2 here. you can use following code with any linux box like centos or ubuntu. Here we solved the issue of directory.

When I inserted the following code in bottom of the httpd.conf file.
<VirtualHost *:80>
Options +FollowSymLinks
ServerAdmin siwan@yahoo.co.in
DocumentRoot /var/www/html/testfolder
ErrorLog logs/error_log_net
TransferLog logs/access_log_net
</VirtualHost>

When tried the http://localhost/ in browser, I got the default browser page.
Then I tried to look my apache error using following command:
#[root@localhost ]# tail -f /var/log/httpd/error_log

In apache error log I got following error.
[Wed Oct 07 15:59:50 2008] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/testfolder/

I changed the AllowOverride option but nothing is happens. Then I read the welcome page text
“To prevent this page from ever being used, follow the instructions in the file /etc/httpd/conf.d/welcome.conf.”
I opend the welcome.conf file.

I found following lines in welcome.conf file.
<LocationMatch “^/+$”>
Options -Indexes
ErrorDocument 403 /error/noindex.html
LocationMatch>

I changed that to as follows:

[viral-lock message=”Solution code is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]

<LocationMatch “^/+$”>
Options Indexes
ErrorDocument 403 /error/noindex.html
</LocationMatch>

[/viral-lock]

That solve my problem. Some time your selinux will cause the issue so you need to deactivate the selinux.
Some time File permission will also cause the issue.
You can change the file permission using following command, go to that directory and run following command.
#chmod 777 *

You can use above commands on any linux box. Ubuntu, centos, redhat or on fedora box.. still solution will be same.