生活随笔 2026年11月22日 · 王小波 · 23 阅读 · 3 分钟 · 0 评论

投稿

投稿者文章

投稿

333

555

888

69 45 373 `server { listen 80; server_name blog.example.com; root /www/wwwroot/blog; index index.php;

charset utf-8; client_max_body_size 20m;

# 禁止访问程序与数据目录 location ~ ^/(app|data)/ { deny all; return 404; }

# 禁止上传目录执行 PHP location ~ ^/uploads/.\.(php|phtml|php5)$ { deny all; return 404; }

# 后台(可选,后台链接本身是 query 形式) location /admin/ { try_files $uri $uri/ /admin/index.php?r=$uri&$args; }

# 全站伪静态:文章、分类、标签、作者、归档、微语、友链、 # 相册、搜索、登录注册、评论提交、点赞接口等全部覆盖 location / { try_files $uri $uri/ /index.php?r=$uri&$args; }

location = /sitemap.xml { rewrite ^ /index.php?r=/sitemap.xml last; }

location = /robots.txt { rewrite ^ /robots.php last; }

location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass unix:/run/php/php8.2-fpm.sock; } }`

20
  • 45
  1. 77
  • 55

王苏洋 IMG_0457.jpeg

项目说明
内容内容

CODE
define('PRETTY_URLS', true);

评论 0

保持友善,认真交流

还没有评论,来说两句吧。

发表评论

评论内容 *
Ctrl / ⌘ + Enter 发送