• 日常搜索
  • 端口查询
  • IP查询
  • 在线工具
  • 搜本站

Nginx 重定向 伪静态 rewrite index.php、https配置

server
{
listen 80;
#listen [::]:80;
server_name www.meidutong.com meidutong.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/www.meidutong.com;

include rewrite/none.conf;
#error_page 404 /404.html;

# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

#include enable-php.conf;
include enable-php-pathinfo.conf;
location / {
if (!-e $request_filename) {
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
index index.html index.htm index.php l.php;
autoindex off;
}

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

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

location ~ /.well-known {
allow all;
}

location ~ /\.
{
deny all;
}

access_log off;
}

server
{
listen 443 ssl http2;
#listen [::]:443 ssl http2;
server_name www.meidutong.com meidutong.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/www.meidutong.com;

ssl_certificate /home/wwwroot/ssh_certificate/www.meidutong.com/Nginx/ww.meidutong.com_bundle.crt;
ssl_certificate_key /home/wwwroot/ssh_certificate/www.meidutong.com/Nginx/www.meidutong.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers "TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
ssl_session_cache builtin:1000 shared:SSL:10m;
#执行以下命令生成对应目录下的对应文件
# openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;

include rewrite/none.conf;
#error_page 404 /404.html;

# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
#伪静态开始
#include enable-php.conf;
include enable-php-pathinfo.conf;
location / {
if (!-e $request_filename) {
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
index index.html index.htm index.php l.php;
autoindex off;
}
#伪静态结束

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

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

location ~ /.well-known {
allow all;
}

location ~ /\.
{
deny all;
}

access_log off;
}

附件地址:

附件为zip压缩包源文件

此处为隐藏内容,请点击右侧联系客服,谢谢!

文章目录
  • UltraEdit for Mac 全新功能:
    • 1、文件处理与无缝工作状态
    • 2、与自动保存的区别
    • 3、HTML优化
    • 4、搜索结果的新展示方式
    • 5、直接在编辑器中打开超链接
    • 6、便捷的快捷键操作
  • 总结:
  • 相关工具:
  • 工具获取地址:
  • 发表评论

    QQ
    站长微信号:
    gixiv_com
    手机扫一扫 关注本站小程序