开发者社区> 问答> 正文

linux下nginx负载均衡配置:配置报错 

请各位大虾高手帮助,nginx的负载均衡配置,不需要安装tomat等软件的。 做web的负载均衡,用nginx.conf配置文件弄的。 求解! 谢谢!  

展开
收起
kun坤 2020-06-04 10:25:15 715 0
1 条回答
写回答
取消 提交回答
  •      你是想通过网页去访问Nginx服务吧######关于配置文件, 还有牛人分别里面的选项做了中文注解, 你可以去找找######关于Nginx配置文件怎么配置,网上有很多啊,我之前就做过类似的,可惜的是之前电脑坏了,数据还没拷贝出来######不是我做的是web负载均衡 但是我采用的是nginx修改配置文件的方法做######



    # 配置 /usr/local/nginx/conf/nginx.conf






    #user nobody;


    worker_processes 4;




    #error_log logs/error.log;


    #error_log logs/error.log notice;


    #error_log logs/error.log info;


    #pid logs/nginx.pid;






    events {


    use epoll;


    worker_connections 10240;


    }






    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;


    client_max_body_size 10m;






    gzip on;


    #gzip_comp_level 4;


    gzip_proxied any;



    gzip_types text/plain text/css application/x-javascript application/javascript text/javascript application/json;






    #gzip_disable "MSIE [1-6].";


    #tcp_nopush on;






    #keepalive_timeout 0;


    keepalive_timeout 65;


    server_tokens off;






    proxy_cache_path cache levels=1:2 keys_zone=redmine:100m inactive=2m max_size=1g;





    server {


    listen 3000;


    server_name localhost;






    #charset utf-8;






    #access_log logs/host.access.log main;


    access_log off;






    location / {


    proxy_cache redmine;


    proxy_cache_valid 200 304 1m;






    proxy_pass http://backend;


    root html;


    index index.html index.htm;


    rewrite /download http://g.cn permanent;


    }






    #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 {


    <span style="font-size:9pt;font

    2020-06-04 11:09:49
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
《应用型负载均衡ALB产品解读》 立即下载
阿里云网络-SLB负载均衡产品介绍 立即下载
负载均衡SLB热点问题解答 立即下载