Created
June 18, 2017 03:40
-
-
Save prasanjit-/8a5b1a9c4e76d0a8216a9a4b2a0fed84 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''''''''''''''''''''''''''''' | |
Nginx Deployment & Using Vagrant | |
''''''''''''''''''''''''''''' | |
:: Nginx :: | |
NGINX is a free, open-source, high-performance HTTP server and reverse proxy server. NGINX is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption. | |
Installation: | |
yum install nginx | |
systemctl start nginx | |
Case 1: | |
Nginx as a Web Server: | |
Config file is in /etc/nginx/nginx.conf | |
### | |
server { | |
listen 80 default_server; ### Port | |
listen [::]:80 default_server; | |
server_name _; | |
root /usr/share/nginx/html; ### Document Root | |
# Load configuration files for the default server block. | |
include /etc/nginx/default.d/*.conf; ### Additional configs | |
location / { | |
} | |
error_page 404 /404.html; | |
location = /40x.html { | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
} | |
} | |
### | |
Case 2: | |
Nginx as Reverse Proxy: | |
Create a file say, /etc/nginx/conf.d/proxy_jenkins.conf with following content: | |
### | |
server { | |
listen 81; | |
server_name foobar.net; | |
location / { | |
proxy_pass http://127.0.0.1:8080; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
} | |
} | |
## | |
:: Vagrant :: | |
- Automates VBOX Creation | |
Steps: (For Vagrant on Windows System) | |
1. Download and install the most recent VirtualBox for Windows from https://www.virtualbox.org/wiki/Downloads | |
Start up VirtualBox | |
2. Download and install the latest version of Vagrant from http://downloads.vagrantup.com. | |
Open Windows cmd prompt | |
For Windows 10, press Windows key and then press “R” key. This will open the RUN dialog box for you. Type “cmd” and press Enter. | |
Note: I typed vagrant command and I got the error message saying, ‘vagrant’ command not recognized. It was not added to the Path during install. Restarting your computer may help to refresh the path. | |
3. Change directory to C:\vagrant\vagrant\bin | |
4. Then type the following commands: | |
C:\vagrant\vagrant\bin> vagrant box add lucid32 http://files.vagrantup.com/lucid32.box | |
C:\vagrant\vagrant\bin> vagrant init lucid32 | |
C:\vagrant\vagrant\bin> vagrant up | |
5. Open Putty and enter these credentials: | |
Hostname: 127.0.0.1 | |
Port: 2222 | |
Connection type: SSH | |
6. Login to Vagrant server | |
Enter username: vagrant | |
Password: vagrant | |
Type ls –lah at the prompt. | |
This is a bare bones server with Ubuntu installed. | |
vagrant@lucid32:~$ls -lah | |
:: Other Examples: | |
C7 Box: | |
vagrant init centos/7; vagrant up --provider virtualbox | |
Tiny-Core Box: | |
https://github.com/prasanjit-/vagrant-tinycore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment