时间:2021-07-01 10:21:17 帮助过:15人阅读
进入安装包下的conf/nginx.conf,注意一定是安装包下的(我的是在installnginx下),而不是源码下的conf。修改文件为:
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
upstream nginxBalance {
server 123.206.75.62:8080 weight=1;
server 123.206.75.62:8180 weight=1;
server 123.206.75.62:8280 weight=1;
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://nginxBalance;
root html;
index index.html index.htm;
}



OK,基本的负载均衡配置就完成了,剩下的就是更深入的学习了
以上就介绍了 Linux下利用Niginx进行负载均衡,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。