Posts

Showing posts with the label Nginx

Nginx Knowledge

Proxy server: work for clients. Example: CDN Reverse Proxy server: work for server. Example Nginx Apache: used as static web server Nginx: only work mode, one work max support 30,000 parallel requests, used for Reverse Proxy Contain One master process and several worker processes, cache loader and cache manager Master process:  1. Check and Verify the config file; 2. Create, bond and close socket; 3. Start, stop and maintain the worker processes; 4. Reload config file; 5. No need stop service, upgrade and rollback the version; Worker process: 1. Support httpd protocol 2. Response to reverse proxy request Cache loader: 1. Check cache objects; 2. Create memory database; Cache manager: 1. Check the expird data of cache objects Nginx modules: only install the required ones. Nginx characters: 1. Modules 2. Upgrade or rollback no need stop service 3. Low memory cost (10000 keep-alive connection only cost 3.5MB memory)  ...

Nginx Proxy & Load Balance & LNMP

Nginx Proxy Service E-commerce website Server 1: provide image request response (  apache / nginx ) Server 2: provide dynamic request response ( php-fpm / apache-php ) Server 3: provide static request response ( apache / nginx ) Server 4: provide data request response ( mysql ) It need one additional nginx server 1. Install nginx 2. proxy to specific server Example location / {      proxy_pass http://192.168.199.187:80/; } location /bbs/ {      proxy_pass http://192.168.199.187:80/bbs/; } location ~* \.(jpg|png|gif)$  {      proxy_pass http://172.16.100.7; } Enhance the log information and specific the hostname location / {      proxy_pass  http://192.168.199.187:80/;      proxy_set_header <parameter name>  $host;  (client requst the hostname )      proxy_set_header <parameter name> $remote_addr; ...