• nginx 配置文件


    proxy.conf

    proxy_redirect off;
    proxy_http_version 1.1;
    proxy_set_header Host $host:$server_port;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    client_max_body_size 50m;
    client_body_buffer_size 256k;
    proxy_connect_timeout 30;
    proxy_send_timeout 30;
    proxy_read_timeout 60;
    
    proxy_buffer_size 64k;
    proxy_buffers 4 32k;
    proxy_busy_buffers_size 64k;
    proxy_temp_file_write_size 64k;
    proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
    proxy_max_temp_file_size 128m;

    html.conf

    location ~ .*.(js|css) {
        expires 3d;
    }
    
    location ~ .*.(ico|jpg|jpeg|gif|png|swf|flv) {
        expires 7d;
    }
    
    location = /favicon.ico {
        access_log off; 
        log_not_found off;
    }
    
    location = /robots.txt  { 
        access_log off; 
        log_not_found off; 
    }

    error.conf

    error_page 400 401 402 403 404 405 /40x.html;
    location = /40x.html {
        root html;
    }
    
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root html;
    }
    
    location ~ /.(svn|git|htaccess) {
        deny all;
    }

    php.conf

    location / {
            try_files $uri $uri/ /index.php?$args;
    }
    
    location ~ .*.php {
            fastcgi_pass 127.0.0.1:9000;
            # fastcgi_pass webservers;
    
            fastcgi_keep_conn on;
            fastcgi_index index.php;
            include fastcgi_params;
    
            set $script    $uri;
            set $path_info  "/";
            if ($uri ~ "^(.+.php)(/.+)") {
                    set $script     $1;
                    set $path_info  $2;
            }
    
            fastcgi_param PATH_INFO $path_info;
            fastcgi_param SCRIPT_FILENAME  $document_root/$script;
            fastcgi_param SCRIPT_NAME $script;
    }

    block_ips.conf

    allow   192.168.0.0/24;
    deny    all;

    upstream.conf

    upstream php_server {
        server 192.168.1.100:9000 weight=40;
        server 192.168.1.101:9000 weight=40;
    }

    vhosts/default.conf

    server {
        listen 80;
        server_name _;
    
        root /home/webapps/default.site;
        index index.html index.php;
    
        location /test {
              proxy_pass http://192.168.1.100:9001;
        }
    
        include php.conf;
        include html.conf;
        include error.conf;
    }

    nginx.conf

    user  nobody;
    worker_processes  1;
    pid        logs/nginx.pid;
    events {
        use epoll;
        worker_connections  1024;
    }
    
    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 /dev/null;
        error_log logs/error.log;
    
        sendfile        on;
        tcp_nopush      on;
        tcp_nodelay     on;
        keepalive_timeout  65;
        
        server_names_hash_bucket_size 128;
        client_header_buffer_size 32k;
        large_client_header_buffers 4 32k;
    
        gzip  on;
        gzip_min_length 1k;
        gzip_buffers 4 16k;
        gzip_http_version 1.0;
        gzip_comp_level 2;
        gzip_types text/plain application/x-javascript text/css application/xml;
        gzip_vary on;
    
        include block_ips.conf;
        include proxy.conf;
        include upstream.conf;
        include vhosts/*.conf;
    }

    转载于:https://my.oschina.net/qiongtaoli/blog/1801496

  • 相关阅读:
    【20220402】黑科技
    【20220331】爱回家
    【20220326】什么才是真正的事业
    【20220403】蓝天白云
    【一句日历】2022年4月
    【20220330】以旧换新
    【20220327】晨跑
    Clickhouse 用户自定义外部函数
    工作感受月记202204月
    java.lang.UnsatisfiedLinkError: dlopen failed: library "xxx.so" not found、java.lang.UnsatisfiedLinkError: No implementation found for xxx解决方法
  • 原文地址:https://www.cnblogs.com/twodog/p/12137038.html
Copyright © 2020-2023  润新知