Nginx makes a proxy

0 View log

tail -f /var/log/nginx/access.log

1 Nginx proxy configuration syntax

1.Nginx proxy configuration syntax

Syntax: proxy_pass URL;Default : —Context: location, if in location, limit_excepthttp://localhost:8000/uri/http://192.168.56.11:8000/uri/http://unix:/tmp/backend.socket:/uri/ 

2. Similar to nopush buffer

//Collect all header requests as much as possible, Syntax: proxy_buffering on | off; Default: proxy_buffering on;Context: http, server, location//Extension: proxy_buffer_size proxy_buffers proxy_busy_buffer_size

3. Jump redirection

Syntax: proxy_redirect default;proxy_redirect off;proxy_redirect redirect replacement;Default: proxy_redirect default;Context: http, server, location

4. Header information

Syntax: proxy_set_header field value;Default: proxy_set_header Host $proxy_host ; proxy_set_header Connection close; Context: http, server, location//Extension: proxy_hid e_headerproxy_set_body

5. TCP connection timeout from proxy to backend

Syntax: proxy_connect_timeout time;Default: proxy_connect_timeout 60s;Context: http, server, location//Extend proxy_read_timeout //and establish proxy_send_timeout //After the server request is completed, send to the client time

6.Proxy The specific configuration of common configuration items is as follows

[[emailprotected] ~]# vim /etc/nginx/proxy_paramsproxy_redirect default;proxy_set_header Host $http_host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_forward_addr;x_connect 30;proxy_send_timeout 60;proxy_read_timeout 60;proxy_buffer_size 32k;proxy_buffering on;proxy_buffers 4 128k;proxy_busy_buffers_size 256k;proxy_max_temp_file_size 256k; // Specific location implementation location / {proxy_pass http://80}; includepre_params http://127.0.0.1:80}; include > 

2 Nginx forward proxy example

Nginx forward proxy configuration example

//Configure 69.113 access restrictions, only allow access to the same network segment location ~ .*\.(jpg|gif|png)$ {allow 192.168.69.0/24; deny all; root /soft/code/images;}//Configure forward proxy[[emailprotected] ~]# cat /etc/nginx/conf.d/zy_proxy.conf server {listen 80; resolver 233.5.5.5; location / {proxy_pass http://$http_host$request_uri; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; })//The client uses the SwitchySharp browser plug-in to configure the forward proxy

3 Nginx reverse proxy example

/proxy proxy[[emailprotected] ~]# cat /etc/nginx/conf. d/proxy.confserver {listen 80; server_name nginx.bjstack.com; index index.html; location / {proxy_pass http://192.168.56.100; include proxy_params; }}//WEB site[[emailprotected] ~]# cat /etc/nginx/conf.d/images.confserver {listen 80; server_name nginx.bjstack.com; root /soft/code; location / {root /soft/code; index index.html;} location ~ .*\ .(png|jpg|gif)$ {gzip on; root /soft/code/images; }}

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4631 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.