快速查阅使用篇

  1. nginx虚拟主机
#80跳转443
server {
    listen 80;
    server_name abc.com;
    rewrite ^(.*)$ https://${server_name}$1 permanent;
}
server {
    #新版nginx废除ssl on
    #改用 listen {端口} ssl
    listen 443 ssl;
    #域名
    server_name oss.huiur.com;
    #路径
    root "/home/www/num1";
    # 设定默认页--不设定默认访问会找不到要访问的文件,尝试列目录然后报403
    index index.html index.htm index.php;
    charset utf-8;
    # 以下设置HTTPS  证书pem和key
    ssl_certificate  cert/1.pem;
    ssl_certificate_key  cert/1.key;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    # 通用匹配
    location / {
        try_files $uri $uri/ /index.php?$query_string;
        #检查是否文件或目录, 把请求重定向到index.php上
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log /data/log/nginx/oss_huiur_com-access.log;
    error_log  /data/log/nginx/oss_huiur_com-error.log error;
    
    # sendfile
    sendfile off;
    
    # nginx 413 错误
    client_max_body_size 100m;

    # 载入fastcgi配置
    include fastcgi.conf;

    location ~ /\.ht {
        deny all;
    }

    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}

详解篇

(待续)