本站参考NGINX SSL代码(让你的WEB环境支持HTTPS访问)

 server {
    listen 80;
    listen       443 ssl;
    server_name www.xxx.com;
    root "E:/www.xxx.com";
    ssl_certificate      E:/www.xxx.com/ssl/server.crt;
    ssl_certificate_key  E:/www.xxx.com/ssl/server.key;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
    ssl_prefer_server_ciphers on;
    location / {
        index index.html index.php index.htm;
    }

    add_header X-Powered-Host $hostname;
    fastcgi_hide_header X-Powered-By;

    if (!-e $request_filename) {
        rewrite  ^/(.+?\.php)/?(.*)$  /$1/$2  last;
        rewrite  ^/(.*)$  /index.php/$1  last;
    }

    location ~ .php(.*)$ {
        fastcgi_pass 127.0.0.1:18153;
        fastcgi_index index.html;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_split_path_info ^(.+.php)(.*)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        include fastcgi_params;
    }


    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
        access_log  off;
        error_log   off;
        expires     30d;
    }

    location ~ .*\.(js|css)?$ {
        access_log   off;
        error_log    off;
        expires      12h;
    }
}

提供参考伪静态规则

NGINX规则参考

    if (!-e $request_filename) {
    rewrite ^/(.*)$ /index.php$1 last;
    break;
}

APACHE规则参考
添加到根目录.htaccess文件内

    <IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

IIS7规则参考
在php网站根目录下新建个web.config文件,内容入下:

 <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.webServer>
        <rewrite>
          <rules>
            <rule name="WPurls" enabled="true" stopProcessing="true">
              <match url=".*" />
              <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
              </conditions>
              <action type="Rewrite" url="index.php/{R:0}" />
            </rule>
          </rules>
        </rewrite>
      </system.webServer>
    </configuration>
 
© 版权声明
THE END
喜欢就支持一下吧
点赞13 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容