Sunday, July 10, 2011

Nginx Installation

I showed you the powerfulness of nginx in my previous post. Now I want to let you know about the installation and configuration of nginx.

For installing nginx in your ubuntu or other GNOME environments, type the following command in the terminal.

sudo apt-get install nginx

You can install any packages by typing in terminal in this format. If you want to remove any packages use the command,

sudo apt-get autoremove <package_name>

After the installation, check whether the server works. Open your Mozilla Firefox and type 127.0.0.1 as the url. If it shows the message “it works”, Apache is already running on your system. You need to stop Apache. Type the following command to view the running processes,

sudo ps ax

It’s just like the task manager in windows. You can stop the processes by the command,

sudo killall -9 <process_name>

After stopping Apache you need to start the nginx server.

sudo /etc/init.d/nginx restart

Then open Mozilla and type the127.0.0.1 and you can view the nginx welcome message which is the default index page of nginx. You can edit this index.html file. Type “cd ..” a number of times to reach the root and enter into /var/www in the file system where you can see a nginx-default folder. Inside that folder you can see the index.html and edit that file by supervisor user. To get the supervisor power, enter “su” in the terminal.

To view the configuration file you can go to /etc/nginx in file system and can see the nginx.conf file.

I hope this will be a useful article for those who are not familiar with the nginx web server.

Thanks

AJAY

No comments:

Post a Comment