首页 > 运维 > nginx > 正文

nginx如何部署配置文件

WBOY
发布: 2023-05-12 12:01:06
转载
1037 人浏览过
user  nobody;
worker_processes  2;
error_log  logs/error.log;
pid        logs/nginx.pid;


events {
    worker_connections  10240;
    accept_mutex on;
    multi_accept on;
    use epoll;
}


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  30;
    keepalive_requests 50000;

    reset_timeout_connection on;

    send_timeout 3;

    gzip  on;
    gzip_min_length 1024;
    gzip_buffers 16 8k;
    gzip_types text/plain application/x-javascript text/css application/xml image/jpeg image/gif image/png;
    gzip_comp_level 6;
    gzip_disable "MSIE 6\.";

    proxy_cache_path /usr/local/nginx/nginx_cache/ levels=1:2 keys_zone=my_zone:10m inactive=300s max_size=5g;

    server{
        listen 80;
        server_name www.pesomarket.com pesomarket.com;
        rewrite /(.*) https://www.pesomarket.com/$1 permanent;
    }

    server{
        listen 443 ssl;
        server_name www.pesomarket.com pesomarket.com;
        ssl_certificate /usr/local/nginx/cert/2286250_pesomarket.com.pem;
        ssl_certificate_key /usr/local/nginx/cert/2286250_pesomarket.com.key;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:!eNULL;
        ssl_prefer_server_ciphers on;
    
        proxy_buffering on;
        proxy_buffer_size 4k;
        proxy_buffers 8 4k;
        proxy_busy_buffers_size 16k;
        proxy_temp_path /usr/local/nginx/proxy_temp 1 2;
        proxy_max_temp_file_size 100M;
        proxy_temp_file_write_size 16k;

        location /{
            proxy_cache my_zone;
            root   /usr/local/android/marketone;
            index  index.html index.htm;
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
        }
    
        location /api/ {
            proxy_pass http://127.0.0.1:8081/estrendMarket/;
            index  index.html index.htm;
            proxy_set_header Host   $host;
            proxy_set_header X-Real-IP      $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }
    
}
登录后复制

以上是nginx如何部署配置文件的详细内容。更多信息请关注PHP中文网其他相关文章!

相关标签:
来源:yisu.com
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!