标签:反向代理 redirect tac local files 反向 upstream 代理 eve
ngxin可以作为静态资源服务器,反向代理服务器,还可以虚拟主机。
nginx配置文件 /nginx/server/conf/nginx.conf
1 #user nobody; #代表当前配置文件的权限 通常设置为root 2 3 server { 4 listen 80; #代表监听的端口 5 server_name localhost; 6 7 #charset koi8-r; 8 9 #access_log logs/host.access.log main; 10 11 location / { #匹配规则 一个sever下面可以有多个location 12 root html; #root 表示根目录 /nginx/server 13 index index.html index.htm; 14 } 15 16 #error_page 404 /404.html; 17 18 # redirect server error pages to the static page /50x.html 19 # 20 error_page 500 502 503 504 /50x.html; 21 location = /50x.html { 22 root html; 23 } 24 25 # proxy the PHP scripts to Apache listening on 127.0.0.1:80 26 # 27 #location ~ \.php$ { 28 # proxy_pass http://127.0.0.1; 29 #} 30 31 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 32 # 33 #location ~ \.php$ { 34 # root html; 35 # fastcgi_pass 127.0.0.1:9000; 36 # fastcgi_index index.php; 37 # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 38 # include fastcgi_params; 39 #} 40 41 # deny access to .htaccess files, if Apache‘s document root 42 # concurs with nginx‘s one 43 # 44 #location ~ /\.ht { 45 # deny all; 46 #} 47 }
proxy_pass 与 upstream 配合使用可以实现转发
location /group {
proxy_pass http://fdfs.com;
}
upstream fdfs.com {
server 10.130.1.101:80;
client_max_body_size 20m; #接收的最大传输大小
}
标签:反向代理 redirect tac local files 反向 upstream 代理 eve
原文地址:https://www.cnblogs.com/dream2true/p/12423854.html