Nginx Web服务器有很多需要我们掌握的知识,其中在进行反向代理配置文件的时候就需要我们格外的注意。下面我们就来仔细研究下有关于Nginx Web服务器的反向代理的命令操作。
- user www www;
- worker_processes 10;
- error_log /var/nginx/logs/error.log;
- #error_log logs/error.log notice;
- #error_log logs/error.log info;
- pid /var/nginx/nginx.pid;
- worker_rlimit_nofile 51200;
- events
- {
- use epoll;
- worker_connections 51200;
- }
- http
- {
- include mime.types;
- default_type application/octet-stream;
- keepalive_timeout 120;
- tcp_nodelay on;
- upstream localhost{
- ip_hash;
- server 10.40.0.46;
- server 10.40.0.47;
- server 10.40.0.48;
- }
- upstream blog.s135.com {
- server 192.168.1.7:8080;
- server 192.168.1.7:8081;
- server 192.168.1.7:8082;
- }
- server
- {
- listen 80;
- server_name localhost;
- location / {
- proxy_pass http://localhost;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- }
- log_format localhost '$remote_addr - $remote_user [$time_local] $request '
- '"$status" $body_bytes_sent "$http_referer" '
- '"$http_user_agent" "$http_x_forwarded_for"';
- access_log /var/nginx/logs/www.log localhost;
- }
- }
以上就是对Nginx Web服务器的详细介绍。
【编辑推荐】