畅聊架构 2020-03-05
ngxin可以作为静态资源服务器,反向代理服务器,还可以虚拟主机。
nginx配置文件 /nginx/server/conf/nginx.conf
#user nobody; #代表当前配置文件的权限 通常设置为root server { listen 80; #代表监听的端口 server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { #匹配规则 一个sever下面可以有多个location root html; #root 表示根目录 /nginx/server index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 26 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; 35 # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache‘s document root 42 # concurs with nginx‘s one 43 # #location ~ /\.ht { 45 # deny all; #} }
proxy_pass 与 upstream 配合使用可以实现转发
location /group {
proxy_pass http://fdfs.com;
}
upstream fdfs.com {
server 10.130.1.101:80;
client_max_body_size 20m; #接收的最大传输大小
}