virtual hosting using nginx

6
Vmoksha Technologies Commit -Deliver –Excel “ Instructional Guide to Virtual Hosting using Nginx Server ’’

Upload: vmoksha-admin

Post on 16-Apr-2017

44 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Virtual hosting using nginx

Vmoksha TechnologiesCommit -Deliver –Excel

“ Instructional Guide to Virtual Hostingusing Nginx Server ’’

Page 2: Virtual hosting using nginx

Vmoksha Technologies Pvt. Ltd.

Nginx is a web server, which can also act as a reverse proxy, HTTP server, IMAP/POP3 proxy server as well as a load balancer. It is well known for its stability, high performance, simple configuration, rich feature set, and low resource consumption. So, we can deploy our web applications like HTML pages and PHP-related applications into this server directly.

Introduction

Page 3: Virtual hosting using nginx

Vmoksha Technologies Pvt. Ltd.

Let’s see How to Configure the Nginx as a Reverse Proxy/Virtual Hosting Purpose –

#1. Deploy the nginx application in any server (I am taking Ubuntu System).

#2. Choose any domain/sub-domain name, and do the C-name configuring that domain name to nginx server (Ubuntu System Port 80).

Note: Port 80 is the default port for nginx. If you change the port, you need to map the C-name according to that.

#3. Once C-name and nginx applications are ready, create a conf.d folder inside the nginx.

#4. Create a configuration file with the name of domain/sub-domain along with the .conf extension.

For example, if you want the application should work on ‘abc.mycompany.com,’ you have to create a configuration file with the name of ‘abc.mycompany.com.conf,’ and copy the code present in the next slide and save the file.

Process

Page 4: Virtual hosting using nginx

Process - Continued

server { listen 80; server_name abc.mycompany.com; location / { proxy_pass http://10.10.10.10:portnumber/; proxy_http_version 1.1; proxy_read_timeout 300000; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } }

#5. Restart/reload the Nginx.

Now your application will work with the domain name based on your configuration.

Vmoksha Technologies Pvt. Ltd.

Page 5: Virtual hosting using nginx

Listen – Nginx port listener

Server_name – Domain name

Proxy_pass – Actual running application URL (domain name indirectly calls this URL)

Proxy_read_timeout – For long connection establishment (optional)

Nginx default connection timeout – 600 m.sec

Glossary

Vmoksha Technologies Pvt. Ltd.

Page 6: Virtual hosting using nginx

Thank You…. Our Official Website - www.vmokshagroup.comFacebook Page - https://www.facebook.com/VmokshagroupGoogle + Page - https://plus.google.com/+VmokshaTechnologiesTwitter Page - https://twitter.com/InfoVmokshaPinterest Page - https://in.pinterest.com/vmokshagroup/LinkedIn Page - https://www.linkedin.com/company/vmoksha-technologiesInstagram Page- https://www.instagram.com/vmoksha.technologies/

Contact Us - 080 4137 6300Address - 2799 & 2800, Srinidhi, Sector-1, 27th Main, HSR Layout, Bengaluru, Karnataka 560102.

Vmoksha Technologies Pvt. Ltd.