MENU

nginx(后台配置)

April 4, 2018 • Read: 3241 • Nginx

server {
        listen 80;
        listen 443;

        server_name 13.229.176.203;

        set $ishttps "off";
            set $root /var/www/nuoruishop/public;
        root $root;
        #入口文件
        index index.php;

        location / {
#    deny 117.159.13.0/24;
#deny 124.89.91.0/24;

        set_real_ip_from 0.0.0.0/0;
    real_ip_header  X-Forwarded-For;
    real_ip_recursive   on;


            root    $root;
            index    index.html index.php;
            client_max_body_size 100m;  #允许客户端请求的最大单文件字节数
            if ( -f $request_filename) {
                break;
            }
            if ( !-e $request_filename) {
                rewrite ^(.*)$ /index.php/$1 last;
                break;
            }
        }


    location ~ .+\.php($|/) {
    set $script $uri;
    set $path_info "";
    if ($uri ~ "^(.+\.php)(/.+)") {
        set $script $1;
        set $path_info $2;
    }
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    fastcgi_index    index.php?IF_REWRITE=1;
    fastcgi_param    PATH_INFO    $path_info;
    fastcgi_param    SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param    SCRIPT_NAME    $script;
    include        fastcgi_params;
}

}

兼总条贯 知至知终

最后编辑于: April 25, 2018