Typecho善后工作

2018年4月30日 Linux 0条评论 阅读次数 902


书接上文

伪静态

server{
     listen               443 ssl http2 default_server;
     listen               [::]:443 ssl http2 default_server;
     server_name          www.96mb.tk;
     root                 /www/typecho;
     index                index.php;
     ssl_certificate      /etc/nginx/ssl/fullchain.cer; 
     ssl_certificate_key  /etc/nginx/ssl/96mb.key;
     ssl_dhparam          /etc/nginx/ssl/dhparam.pem;
     ssl_ciphers          EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
     ssl_protocols        TLSv1 TLSv1.1 TLSv1.2;
     ssl_session_cache    shared:SSL:10m;
     ssl_session_timeout  10m;
     ssl_stapling         on;
     ssl_stapling_verify  on;
     ssl_prefer_server_ciphers on;
     add_header Strict-Transport-Security max-age=15552000;
     gzip                 on;
     gzip_comp_level      6;
     gzip_proxied         any;
     gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript application/x-font-woff application/octet-stream ;
    location / {
        if (!-e request_filename) {             rewrite ^(.*) /index.php1 last; # 去掉该行 # 即可         }     }     location ~ .*\.php(\/.*)* {
         include          snippets/fastcgi-php.conf;
         fastcgi_pass     unix:/run/php/php7.0-fpm.sock;
         fastcgi_param    SCRIPT_FILENAME      document_rootfastcgi_script_name;
     }
}
server{
     listen      80 default_server;
     listen      [::]:80 default_server;
     return 301  https://www.96mb.tkrequest_uri;  } server {      server_name 96mb.tk;      return 301  https://www.96mb.tkrequest_uri;
}

对于IIS的web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="typecho" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>



php文件上传最大限制

php.ini的具体位置

/etc/php/7.0/fpm/php.ini

修改配置文件(3处):

1. 加长php执行时间限制(368行)
max_execution_time = 0
2. 增加POST数据最大限制(656行)
post_max_size = 150M
3. 增加上传文件最大限制(809行)
upload_max_filesize = 150M