Easy Setup NGINX Webserver

Sunday, 17. March 2013

 Nginx is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. 

http://wiki.nginx.org/Main

 

Set Up / Install

sudo apt-get install nginx

Create a New Directory under /var/www/html

sudo mkdir -p /var/www/html/MyDomain.com/

 

Create a New INDEX.html under /var/www/html

sudo nano /var/www/html/MyDomain.com/index.html

Create the default index.html page

<html>
<head>
<title>www.MyDomain.com</title>
</head>
<body>
<h1>This is your first virtual host</h1>
</body>
</html>

 

Create the New Virtual Host File

 sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/MyDomain.com

 

Set Up the Virtual Hosts

sudo nano /etc/nginx/sites-available/MyDomain.com

Make changes in the NGINX.conf file

Server {
listen 80;

root /var/www/MyDomain.com;
index index.html index.htm;
server_name MyDomain.com;
}

Create a symbolic link between the sites-available directory and the sites-enabled directory

sudo ln -s /etc/nginx/sites-available/MyDomain.com /etc/nginx/sites-enabled/MyDomain.com

Restart NGINX

sudo service nginx restart

Comments are closed.