server {
    server_name localhost;
    listen 80 default_server;
    #listen 443 ssl;
    #ssl_certificate /usr/local/openresty/nginx/conf/conf.d/ssl/mapi.jstyle.cn.pem;
    #ssl_certificate_key /usr/local/openresty/nginx/conf/conf.d/ssl/mapi.jstyle.cn.key;

    autoindex on;

    gzip on;
    gzip_min_length 1k;
    gzip_comp_level 2;
    gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
    gzip_vary on;
    gzip_disable "MSIE [1-6]\.";

    location ~* ^.+\.(ico|gif|jpg|jpeg|png)$ {
            add_header Access-Control-Allow-Origin *;
            add_header Access-Control-Allow-Headers X-Requested-With;
            add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
            access_log off;
            expires 30d;
    }
    location ~* ^.+\.(css|js|txt|xml|swf|wav)$ {
            access_log off;
            expires 24h;
    }
    location ~* ^.+\.(eot|ttf|otf|woff|svg)$ {
            access_log off;
            expires max;
    }

    set $charset utf-8;
    charset $charset;

    set $rootdir /www;
    if ( $request_uri ~* ^/(dever_package\/manage|dever_package\/ui|dever_package\/script) ) {
        set $rootdir /share/lib/php;
    }
    root $rootdir;
    index index.php index.html;
    if ( $request_uri ~* /(applet\/content|applet_on\/content) ) {
            rewrite ^/(.*)/content/(.*) /$1/content/index.php?$2 last;
    }
    if ( $request_uri ~* /log\/data.add ) {
            rewrite ^/log/(.*?) /log/index.php?$1 last;
    }
    if ( $request_uri ~* /system/wechat ) {
            rewrite ^/system/wechat /system/index.php?m=payment&a=wechat_notify last;
    }
    if ( $request_uri ~* /pay/pay/notify ) {
            rewrite ^/pay/pay/notify/([0-9+]) /pay/pay/index.php?l=api.notify&account_id=$1 last;
    }
    if ( $request_uri ~* /public ) {
            rewrite ^/(.*)/public/(.*) /$1/public/index.php?$2 last;
    }
    location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
    }

    #location ~ ^(.*)$ {
    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini (No settings!)

        # With php-cgi alone:
        #fastcgi_pass web-php7_swoole:9000;
        fastcgi_pass web-php7:9000;
        #fastcgi_pass web-php5:9000;
        # With php-fpm:
        #fastcgi_pass unix:/var/run/php7-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME  $rootdir/$fastcgi_script_name;
        #fastcgi_param  PATH_INFO $fastcgi_path_info;
        include fastcgi_params;
    }
}

#server {
    #server_name wx.shemic.com;
    #listen 80; # 或者 443，如果你使用 HTTPS 的话
    #ssl on; 是否启用加密连接
    #如果你使用 HTTPS，还需要填写 ssl_certificate 和 ssl_certificate_key

    #location / { # 如果你希望通过子路径访问，此处修改为子路径，注意以 / 开头并以 / 结束
        #proxy_pass http://wx.shemic.com:5000/;
    #}
#}
