Contes Configuring Nginx Tutorials

Source: Internet
Author: User


Installing Vue http://blog.51cto.com/aaronsa/2064466


Nginx
---------------------------------------
I. Introduction of the Course

1. Application Scenarios
2. Virtual Host (IP, port, domain name)
3. Reverse Proxy
4. Load Balancing


Openresty (based on Nginx package)

Nginx+lua Performance Cow B!
Openresty Installation
Nainx+lua Simple Development

---------------------------------------

Two. Nginx's application Scenario

1. What is Nginx?

High performance, official test 50,000 concurrent connection
The CPU memory consumption is very low, and runs very stable free open source


2.nginx application scenario?

1.http Server
. static resource picture, JS,CSS

2. Virtual Hosting
"Virtual" out of multiple hosts, domain 80 directory
IP Port Domain Name


3. Reverse Proxy

Agent from outside to inside


4. Load Balancing

The literal understanding: load to become balanced

Workload balancing for servers

Servers to load balance servers.


5 ...

---------------------------------------

Three. Installation of Nginx

Download: SECURECRT

Http://www.pc141.com/html/wangluoruanjian/371.html

File on F Drive

Download: http://nginx.org/en/download.html

wget http://nginx.org/download/nginx-1.14.0.tar.gz


II is the display directory

Clear Clear Screen

Installation premise, Nginx is developed by C

1.GCC to compile the source code

Yum Install gcc-c++

2.PCRE Library

The per library includes a per-compatible regular expression Nginx HTTP module using PCRE to parse the regular


Yum install-y pcre Pcre-devel

3.zlib

Compression and decompression of the vault Nginx is using zlib to gzip the HTTP packet

Yum Install-y zlib-devel

4.openssl

Yum Install-y OpenSSL Openssl-devel


!!!!!!!!!!!!

Nginx Installation

1. Unzip

TAR-ZXVF nginx-1.14.0.tar.gz

2.CD to the extracted directory

CD nginx-1.14.0

3.configure

Configuration

./configure--prefix=/app/nginx\
--with-pcre\
--with-thhp_stub_status_module\
--with-http_realip_module\
--with-http_addition_module\
--with-file-aio\
--with-debug\


Copy execution generates a file Makeflie

4. Compiling the installation

Make && make install


5. Start

Switch to the installed directory

Cd/app/nginx--with-pcre--with-thhp_stub_status_module--with-http_realip_module--with-http_addition_ Module--with-file-aio--with-debug
[Email protected] nginx--with-pcre--with-th

You can rename the nginx yourself here.

This directory is a little disgusting.

CD Sbin

Perform

./nginx

The above sentence is not a clue to what is normal.


If a heap of 0.0.0.0:80 is present, the port is occupied

Ps-auxlgrep 80


To see if the execution was successful

Ps-aixlgrep Nginx


Verify

Direct input public IP browser access to a message with nginx, it means success.

Welcome to nginx!

----------------------------------------------------

Configuration

CD [Installation directory]/conf/

Configured files: nginx.conf (default profile)

Modify the Load Profile command

./nginx-c/app/nginx/conf/nginx (This individual disorder is not changed generally)


If you want to end a process

In the Sbin directory execution:./nginx-s stop

Find out the PID first and then kill the packet.


Off mode two: complete stop graceful off

./nginx-s quit

Wait for Nginx to process, finish the request, and then stop

Restart Nginx:./nginx-s Reload


---------------------------------------------------------------

Four. The concept of virtual host and the type of configuration

1. Virtual Hosting

Dividing a physical host into multiple virtual servers,
Each server can have a separate domain name or directory

2.ngnx How to configure virtual main clauses

1. IP-based (almost unused)
2. Port-based (less used)
3. Domain-based (multi-use)

Use domain names to differentiate (develop a self-built server)


---------------------------------------------------------------

Five, configure the virtual host (not important) based on the ip& port number

1.IP

A single server binds multiple IPs

193.112.12.42

Check IP information command: ifconfig

Bind a 193.112.12.43

/sbin/ifconfig/eth0:1 192.168.101.103 broadcast 172.16.15.255 netmask 255.255.240.0 up

/sbin/route add-host 192.168.101.103 Dev eth0:1

(server restart will fail)

Way Two

/etc/sysconfig/network-scripts/ifcfg-etg0 a copy of the file named Ifcfg-eth0:1

Modify the second-to-last IP


Requires a reboot to take effect

Nginx

In: nginx.conf
A server is a virtual host

Restart Nginx./nginx/-S Reload


2. Port-based

192.168.101.10:80
192.168.101.10:81
192.168.101.10:82


In: nginx.conf

Copy the server code snippet and then modify the inside port to

Modified is Lister.
Modify root is the root directory of the specified virtual host

Restart Nginx./nginx/-S Reload

The above two methods have shortcomings, do not recommend the use of

-----------------------------------------

Six. Domain-based virtual host configuration


Modify

/app/nginx--with-pcre--with-thhp_stub_status_module--with-http_realip_module--with-http_addition_ module--with-file-aio--with-debug/conf/

Nginx.conf

Server

The server_name

vue.5c0.cn

-----------------------------------------


Seven. Nginx Configuration Nginx Reverse Proxy

Related Blogs
79458266

Nginx Proxy Server

Reverse proxy from outside to inside

Agent is the intranet server


Demand

Visit vue.5c0.cn

Go to

193.112.12.42:8080

172.16.0.6:8080;

Upstream tovue{
#内网ip
Server 172.16.0.6:8080;
}

localhost


-----------------------------------------

Finally, success can be accessed

http://vue.5c0.cn/#/


-----------------------------------------

Vue-cli

Config/index.js

LocalHost to intranet IP

Build inside

Added in Webpack.dev.conf.js: disablehostcheck:true


The details can be seen below

Https://www.cnblogs.com/zhuwu/p/8080982.html


-----------------------------------------


Resolves a remote connection cannot be accessed after it has been closed


80980779


Yum-y Install screen

Screen-s Koawork

NPM start

Https://www.aliyun.com/jiaocheng/150730.html

Resolve disconnected remote still available

Start Nginx before you start the project.

-----------------------------------------

Open a new Session window: Screen
End Current session: Exit

Screen-s Run
Screen-s ser

-----------------------------------------

2. Screen command
If the program requires complex operations such as interactivity, it is recommended to use the powerful screen. Screen provides the ansi/vt100 terminal emulator, which enables it to run multiple full screens of pseudo-terminals under a real terminal.
Not all Linux comes with screen. Query installation package information: Rpm-qa|grep screen
Installation method:

CentOS System: Yum install screen
Debian System: Apt-get Install screen
Usage:

Open a new Session window: Screen
End Current session: Exit
Executing a program in a new session (Session Auto-end when program closes): Screen VI test.c
Open a new session and name: Screen-s myname
Temporarily leave session (often used): Ctrl + A and D
View Session list: Screen-ls
Session left before recovery: screen-r Session name or process number
Clearing the dead state of a session: Screen-wipe
Start a session that starts with a detached state: Screen-dms name command
Common shortcut key functions
CTRL + A? Show all key binding information
CTRL + A D temporarily leaves session before returning to Shell (session enters detached state)
CTRL + A W displays a list of all windows (not including the detached state)
CTRL + A CTRL + a switch to the previously displayed window (without toggling the detached state)
CTRL + A C create a new window to run the shell and switch to that window
CTRL + A n switches to the next window
CTRL + A p switch to the previous window
CTRL + a 0..9 switch to Windows 0: 9
CTRL + A k to kill the current window (will prompt for confirmation)
-----------------------------------------

-----------------------------------------


Config/index.js

LocalHost to intranet IP

Build inside

Added in Webpack.dev.conf.js: disablehostcheck:true

Cannot overwrite
/config
/build/webpack.dev.conf.js

Contes Configuring Nginx Tutorials

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.