Nginx is a Web Server.The Nginx is a open source web server. It can act as a reverse proxy for the Http, Https, etc.Here we are mainly using it to configure Local host. nginx How to configure Nginx : Download and install Nginx from their official website http://nginx.org/en/download.html Extract the zip file into any drive using winrar. Locate the extracted folder, C:\nginx-1.8.0\nginx-1.8.0\conf (In here, the Nginx is installed into the C drive) Then open nginx.config file from the list using notepad. Include the location of the current working directory. This points the nginx server to acts as a Local host. Make other location as a comments by adding # previously to the location path. Nginx Main Config Sample file : 1)Modify your main nginx.conf file (nginx/conf/nginx.conf)

#user  nobody;
worker_processes  1;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#pid        logs/nginx.pid;
events {
    worker_connections  1024;    
http {
    include       mime.types;
    default_type  application/octet-stream;
    include C:/nginx/conf/sites-enabled/*.conf;

2)open directory path C:/nginx/conf/sites-enabled create file localhost.conf file

** localhost.conf **

server {

    listen  80;
    server_name  localhost;

    charset koi8-r;

    access_log  logs/localhost.access.log;

    location / {
        root C:\Users\aaa\Documents\clofus-enterprise; # Your Project Directory (absolute Path)
        try_files $uri $uri/ /index.html =404;


3)To Run Multiple hosts, copy the above code and create file as example.conf and change your system host file

For windows : Download host File Editor https://hostsfileeditor.codeplex.com and open host file editor and add ip address pointing to to your host name

For Linux: Open etc/hosts and add ip address pointing to to your host name

4)Finally Restart Nginx

For Example : root C:\Users\Dell\Desktop\AngularJs; (AngularJs is the folder for the nginx localhost).

Note : Include # before the C:\Users\Dell\Desktop\AngularJs; to make this line as a comment.

How to Enable HTML Mode In nginx ? Include try_files $uri $uri/ /index.html =404; line below to the localhost path. This will try to find and open the index.html file inside the localhost path and if the file is not found it will display Error 404 file not Found.

Note : The default Ip address for the local host is

How to change the Default server Name : If you wish to change your server name from the default (By default the server name is Localhost) Change your preferred name instead of localhost in server_name localhost; (Replace Localhost by your preferred name).

Configure Host file : Download and install host file editor from https://hostsfileeditor.codeplex.com/ edit and change the default Ip address of the local host or any other Ip if you wish to.

Installation : 1.Download nginx stable version. (link:http://nginx.org/en/download.html) 2.Move the zip Ng-inx folder to location *C:* 3.Unzip it 4.open conf folder and open nginx.conf file 5.change location / { root C:\Users\clofus\Documents\projects\clofus-dev- app\clofus-dev-app; index index.html index.htm; } under server 6.Enter localhost in the address bar of browser it shows the index page

To Configure nginx in Linux

1.Open command window in linux 2.Enter path as “cd /etc/nginx/ sites-enabled/” 3.To Edit default file enter “gksudo gedit default” in command 4.Default file will open in edit window then add the current working directory under location 5.Then restart the nginx using command “sudo service nginx restart”, Now localhost will run as internal server

For any query contact Clofus Innovations.

Contact Us

Just leave your email and our support team will help you