NGINX learning (X) - nginx forwarded to the local configuration file

1 to build a good nginx, you can use 

In nginx.conf profile 2, on http modules, server module to modify, add a location

location / Yandex / {
  root html;	
  rewrite ^//(.*)$ \$1 break;
}

3 sbin / nginx -t, sbin / nginx -s reload, reload it nginx configuration file.

4 nginx / html folder, create a new folder esIndex, create a file test.info, inside write some test content. Then access path: http: // ip + port /esIndex/test.info, where ip and port of nginx ip and listening port, you can access the contents of the folder esIndex by nginx.

5 esIndex fact, do not create a folder, create esIndex.info directly in the html folder, visit http: // ip + port /esIndex.info, is also available.

 

Here is nginx.conf configuration:

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    server_tokens off;
    keepalive_timeout  75;
    gzip  on;
    client_max_body_size       100m;
    #client_body_buffer_size    4096k;
    client_body_buffer_size    20m;
    proxy_connect_timeout      600;
    proxy_read_timeout         300;
    proxy_send_timeout         600;
    proxy_buffer_size          128k;
    proxy_buffers              32 128k;
    proxy_busy_buffers_size    128k;
    proxy_temp_file_write_size 512k;
    proxy_next_upstream http_500 http_502 http_503 error invalid_header;
    proxy_temp_path /home/zyzx_test/nginx/proxy_temp;
    proxy_cache_path /home/zyzx_test/nginx/proxy_cache
    levels=1:2 keys_zone=cache_one:100m inactive=2d max_size=2g;

    server {
        listen       22022;
        server_name  localhost;
        
        location / Yandex / {
            root html;    
            rewrite ^//(.*)$ \$1 break;
        }
    }
}

 

Guess you like

Origin www.cnblogs.com/gllegolas/p/12610634.html