ngnix初探

http://nginx.org/en/download.html 下载 Stable version  1.10.1


解压 tar -zxvf nginx-1.10.1.tar.gz 这是源文件,配置属性后通过make编译安装


yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel  一键安装依赖


cd nginx-1.10.1
./configure --prefix=/usr/local/nginx 
make
make install

安装完成之后,检查nginx的配置文件是否正确
cd /usr/local/nginx/sbin
./nginx -t

显示

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful


配置proxy.conf

# proxy.conf
proxy_redirect        off;
proxy_set_header    Host $host;
proxy_set_header    X-Real-IP $remote_addr;
client_max_body_size      10m;
client_body_buffer_size   128k;
proxy_connect_timeout     90;
proxy_send_timeout        90;
proxy_read_timeout        90;
proxy_buffer_size         4k;
proxy_buffers             4 32k;
proxy_busy_buffers_size   64k;
proxy_temp_file_write_size 64k;


配置 nginx.conf

user  root;            #运行用户
worker_processes  1;        #启动进程,通常设置成和cpu的数量相等


#全局错误日志及PID文件
error_log  /usr/local/nginx/logs/error.log;
error_log  /usr/local/nginx/logs/error.log  notice;
error_log  /usr/local/nginx/logs/error.log  info;
pid        /usr/local/nginx/logs/nginx.pid;


# 工作模式及连接数上线
events {
    use epoll;            #epoll是多路复用IO(I/O Multiplexing)中的一种方式,但是仅用于linux2.6以上内核,可以大大提高nginx的性能


    worker_connections  1024;    #单个后台worker process进程的最大并发链接数
}


#设定http服务器,利用它的反向代理功能提供负载均衡支持
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;


    #设定请求缓冲
    server_names_hash_bucket_size  128;
    client_header_buffer_size   32K;
    large_client_header_buffers  4 32k;
    # client_max_body_size   8m;
    
    #sendfile 指令指定 nginx 是否调用 sendfile 函数(zero copy 方式)来输出文件,对于普通应用,
    #必须设为 on,如果用来进行下载等应用磁盘IO重负载应用,可设置为 off,以平衡磁盘与网络I/O处理速度,降低系统的uptime.
    sendfile        on;
    tcp_nopush     on;
    tcp_nodelay    on;


    #连接超时时间
    #keepalive_timeout  0;
    keepalive_timeout  65;


    #开启gzip压缩,降低传输流量
    gzip  on;
    gzip_min_length    1k;
    gzip_buffers    4 16k;
    gzip_http_version  1.1;
    gzip_comp_level  2;
    gzip_types  text/plain application/x-javascript text/css  application/xml;
    gzip_vary on;


    #添加tomcat列表,负载均衡的服务器都放在这
    upstream tomcat_pool {
        #server tomcat地址:端口号 weight表示权值,权值越大,被分配的几率越大;
    server 101.201.233.141:4001 weight=4 max_fails=2 fail_timeout=30s;
    server 101.201.233.141:5001 weight=4 max_fails=2 fail_timeout=30s;
    }


    server {
        listen       80;        #监听端口    
        server_name  101.201.233.141; #对外提供服务的网址(域名或者ip)
        index index.html;




location = / {
                proxy_pass http://tomcat_pool/index.html;
     }
    
    #默认请求设置
    location / {
proxy_pass http://tomcat_pool;
#        index index.jsp index.html index.htm;   #设定访问的默认首页
#        root /usr/local/tomcat/4001_tomcat/webapps;    #站点根目录,此目录下存放我们的web项目
    }
    
    #charset koi8-r;


        #access_log  logs/host.access.log  main;


    
    #所有的jsp页面均由tomcat处理
    location ~ \.(jsp|jspx|dp)?$
    {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://tomcat_pool;    #转向tomcat处理
    }
    
    #所有的静态文件直接读取不经过tomcat,nginx自己处理
    location ~ .*\.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$ 
    { 
        expires  30d;
    }
        location ~ .*\.(js|css)?$
        {
               expires  1h;
        }
        #log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '$status $body_bytes_sent "$http_referer"' '"$http_user_agent" $http_x_forwarded_for';
        #access_log  /usr/local/nginx/logs/ubitechtest.log access;#设定访问日志的存放路径     


        # redirect server error pages to the static page /50x.html
        #


    #定义错误提示页面
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }


    }
}


结果:

http://101.201.233.141/

自动 

tomcat——5001

tomcat——4001

切换

内容概要:本文详细介绍了如何利用Simulink进行自动代码生成,在STM32平台上实现带57次谐波抑制功能的霍尔场定向控制(FOC)。首先,文章讲解了所需的软件环境准备,包括MATLAB/Simulink及其硬件支持包的安装。接着,阐述了构建永磁同步电机(PMSM)霍尔FOC控制模型的具体步骤,涵盖电机模型、坐标变换模块(如Clark和Park变换)、PI调节器、SVPWM模块以及用于抑制特定谐波的陷波器的设计。随后,描述了硬件目标配置、代码生成过程中的注意事项,以及生成后的C代码结构。此外,还讨论了霍尔传感器的位置估算、谐波补偿器的实现细节、ADC配置技巧、PWM死区时间和换相逻辑的优化。最后,分享了一些实用的工程集成经验,并推荐了几篇有助于深入了解相关技术和优化控制效果的研究论文。 适合人群:从事电机控制系统开发的技术人员,尤其是那些希望掌握基于Simulink的自动代码生成技术,以提高开发效率和控制精度的专业人士。 使用场景及目标:适用于需要精确控制永磁同步电机的应用场合,特别是在面对高次谐波干扰导致的电流波形失真问题时。通过采用文中提供的解决方案,可以显著改善系统的稳定性和性能,降低噪声水平,提升用户体验。 其他说明:文中不仅提供了详细的理论解释和技术指导,还包括了许多实践经验教训,如霍尔传感器处理、谐波抑制策略的选择、代码生成配置等方面的实际案例。这对于初学者来说是非常宝贵的参考资料。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值