nginx配置文件

sockstat  查看所有端口


server
{
    listen 80;
    server_name www.bghome.com;
    index index.php index.html index.htm;
    root /data/www/bighome/myhome/www;
    autoindex on;
    large_client_header_buffers 4 16k;
    client_max_body_size 300m;
    client_body_buffer_size 128k;
    proxy_connect_timeout 600;
    proxy_read_timeout 600;
    proxy_send_timeout 600;
    proxy_buffer_size 64k;
    proxy_buffers   4 32k;
    proxy_busy_buffers_size 64k;
    proxy_temp_file_write_size 64k;

    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    if ($host = 'bghome.com' ) {
        rewrite ^/(.*)$ http://www.bghome.com/$1 permanent;
    }

    location = /favicon.ico {
        root   /data/www/bighome/myhome/www;
    }

    # Deny all attempts to access hidden files such as .htaccess, .htpasswd,.DS_Store(Mac).
    location ~ /\. {
           deny all;
    }

    location ~* /(?:uploads|files)/.*\.php$ {
           deny all;
    }

    location / {
           try_files $uri $uri/ /index.php?$args;
           proxy_pass http://127.0.0.1:9000;
           proxy_read_timeout 300;
           proxy_set_header Host $host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
        access_log off;
        log_not_found off;
        expires max;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires 24h;
        log_not_found off;
    }

    error_page  404              /404.html;

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
    location ~* \.(eot|otf|ttf|woff)$ {
        add_header Access-Control-Allow-Origin *;
    }

    location ~  \.php
    {
         fastcgi_index index.php;
         fastcgi_pass 127.0.0.1:9000;
         #fastcgi_pass unix:/var/run/php-fpm/php-fpm55.sock;
         include      fastcgi_params;
         set $path_info "";
         set $real_script_name $fastcgi_script_name;
         if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
         set $real_script_name $1;
         set $path_info $2;
    }
    fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
    fastcgi_param SCRIPT_NAME $real_script_name;
    fastcgi_param PATH_INFO $path_info;
}

#location ~ ^(.+\.php)(.*)$
#{
#       fastcgi_split_path_info ^(.+\.php)(/.+)$;
#       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#       fastcgi_param PATH_INFO $fastcgi_path_info;
#       fastcgi_index index.php;
#       fastcgi_pass 127.0.0.1:9000;
#       #fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
#       include fastcgi_params;
#}
#error_page  500 502 503 504 /50x.html;
#location = /50x.html {
#       root /var/www;
#}
#include location.conf;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值