Tuesday, February 4, 2014

5:12 AM
Good day!

I just wanna share what I did to run simultaneously 2 different http server, the nginx and apache using different ports.


Nginx, (pronounced engine-x) is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. Igor Sysoev started development of Nginx in 2002, with the first public release in 2004. Nginx now hosts nearly 12.18% (22.2M) of active sites across all domains. Nginx is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.
Nginx is one of a handful of servers written to address the C10K problem. Unlike traditional servers, Nginx doesn't rely on threads to handle requests. Instead it uses a much more scalable event-driven (asynchronous) architecture. This architecture uses small, but more importantly, predictable amounts of memory under load.
Even if you don't expect to handle thousands of simultaneous requests, you can still benefit from Nginx's high-performance and small memory footprint. Nginx scales in all directions: from the smallest VPS all the way up to clusters of servers.

Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation. Most commonly used on a Unix-like system, the software is available for a wide variety of operating systems, including Unix, FreeBSD, Linux, Solaris, Novell NetWare, OS X, Microsoft Windows, OS/2, TPF, OpenVMS and eComStation. Released under the Apache License, Apache is open-source software.
 
First I installed nginx and apache on my ubuntu 12.04 machine.

$ sudo apt-get update
$ sudo apt-get install apache2
$ sudo apt-get install nginx

In my case I edited my apache to run with port 70 and nginx the default 80.
By default, apache will start automatically after installation. So you need to
$ sudo service stop apache2

After stopping you can now change the ports configuration of apache under
sudo vim /etc/apache2/ports.conf
 and
sudo vim /etc/apache2/sites-enabled/000-default

nginx

You can now start both http server by
$ sudo service nginx start
$ sudo service apache2 start

Then check http://localhost/   # <-- By default nginx is port 80
For apache, you can now browse it using http://localhost:70


Congratulations! You have now installed nginx and apache running

0 comments:

Post a Comment